InOrOutOfWarehouseService.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package thyyxxk.webserver.service.datamodify;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7. import thyyxxk.webserver.config.exception.ExceptionEnum;
  8. import thyyxxk.webserver.constants.Capacity;
  9. import thyyxxk.webserver.dao.his.datamodify.InOrOutOfWarehouseDao;
  10. import thyyxxk.webserver.entity.ResultVo;
  11. import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
  12. import thyyxxk.webserver.entity.datamodify.InOrOutOfWarehousePojo;
  13. import thyyxxk.webserver.entity.datamodify.YpInDetl;
  14. import thyyxxk.webserver.entity.datamodify.YpOutDetl;
  15. import thyyxxk.webserver.utils.ResultVoUtil;
  16. import thyyxxk.webserver.utils.TokenUtil;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. /**
  21. * <p>
  22. * 描述: 药品入库或出库
  23. * </p>
  24. *
  25. * @author xc
  26. * @date 2021-06-01 14:07
  27. */
  28. @Service
  29. @Slf4j
  30. public class InOrOutOfWarehouseService {
  31. private final InOrOutOfWarehouseDao dao;
  32. @Autowired
  33. public InOrOutOfWarehouseService(InOrOutOfWarehouseDao dao) {
  34. this.dao = dao;
  35. }
  36. public ResultVo<Map<String, Object>> queryRuKuXinXi(InOrOutOfWarehousePojo param) {
  37. IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
  38. List<YpInDetl> list = dao.queryRuKuXinXi(page, param);
  39. if (list.size() > 0) {
  40. Map<String, Object> map = new HashMap<>(Capacity.TWO);
  41. map.put("data", list);
  42. map.put("total", page.getTotal());
  43. return ResultVoUtil.success(map);
  44. }
  45. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
  46. }
  47. public ResultVo<List<GetDropdownBox>> queryCode(String pyCode, Integer flag) {
  48. if (flag == 1) {
  49. //供应商
  50. return ResultVoUtil.success(dao.queryCode("yp_zd_supply", pyCode.toUpperCase() + "%"));
  51. } else if (flag == 2) {
  52. //采购员
  53. return ResultVoUtil.success(dao.queryCode("a_employee_mi", pyCode.toUpperCase() + "%"));
  54. } else if (flag == 3) {
  55. //生产厂家
  56. return ResultVoUtil.success(dao.queryCode("yp_zd_manufactory", pyCode.toUpperCase() + "%"));
  57. }
  58. return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR);
  59. }
  60. public ResultVo<String> xiuGiRuKuXinXi(YpInDetl param) {
  61. dao.xiuGiRuKuXinXi(param);
  62. log.info("修改入库信息:{},修改人:{}", param, TokenUtil.getTokenUserId());
  63. return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "修改成功");
  64. }
  65. /* 出库的信息*/
  66. public ResultVo<Map<String, Object>> queryChuKuXinXi(InOrOutOfWarehousePojo param) {
  67. log.info("查询出库数据:{}", param);
  68. IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
  69. List<YpOutDetl> list = dao.queryChuKuXinXi(page, param);
  70. if (list.size() > 0) {
  71. Map<String, Object> map = new HashMap<>(Capacity.TWO);
  72. map.put("data", list);
  73. map.put("total", page.getTotal());
  74. return ResultVoUtil.success(map);
  75. }
  76. return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
  77. }
  78. public ResultVo<Map<String, Object>> queryDeptCode() {
  79. Map<String, Object> map = new HashMap<>(Capacity.TWO);
  80. map.put("deptCode", dao.queryDeptCode());
  81. map.put("groupNo", dao.queryGroupNo());
  82. return ResultVoUtil.success(map);
  83. }
  84. public ResultVo<String> xiuGaiChuKuXinXi(YpOutDetl param) {
  85. log.info("修改出库信息:{},修改人:{}", param, TokenUtil.getTokenUserId());
  86. dao.xiuGaiChuKu(param);
  87. return ResultVoUtil.success("修改成功");
  88. }
  89. }