123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package thyyxxk.webserver.service.datamodify;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import thyyxxk.webserver.config.exception.ExceptionEnum;
- import thyyxxk.webserver.constants.Capacity;
- import thyyxxk.webserver.dao.his.datamodify.InOrOutOfWarehouseDao;
- import thyyxxk.webserver.entity.ResultVo;
- import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
- import thyyxxk.webserver.entity.datamodify.InOrOutOfWarehousePojo;
- import thyyxxk.webserver.entity.datamodify.YpInDetl;
- import thyyxxk.webserver.entity.datamodify.YpOutDetl;
- import thyyxxk.webserver.utils.ResultVoUtil;
- import thyyxxk.webserver.utils.TokenUtil;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * <p>
- * 描述: 药品入库或出库
- * </p>
- *
- * @author xc
- * @date 2021-06-01 14:07
- */
- @Service
- @Slf4j
- public class InOrOutOfWarehouseService {
- private final InOrOutOfWarehouseDao dao;
- @Autowired
- public InOrOutOfWarehouseService(InOrOutOfWarehouseDao dao) {
- this.dao = dao;
- }
- public ResultVo<Map<String, Object>> queryRuKuXinXi(InOrOutOfWarehousePojo param) {
- IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
- List<YpInDetl> list = dao.queryRuKuXinXi(page, param);
- if (list.size() > 0) {
- Map<String, Object> map = new HashMap<>(Capacity.TWO);
- map.put("data", list);
- map.put("total", page.getTotal());
- return ResultVoUtil.success(map);
- }
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
- }
- public ResultVo<List<GetDropdownBox>> queryCode(String pyCode, Integer flag) {
- if (flag == 1) {
- //供应商
- return ResultVoUtil.success(dao.queryCode("yp_zd_supply", pyCode.toUpperCase() + "%"));
- } else if (flag == 2) {
- //采购员
- return ResultVoUtil.success(dao.queryCode("a_employee_mi", pyCode.toUpperCase() + "%"));
- } else if (flag == 3) {
- //生产厂家
- return ResultVoUtil.success(dao.queryCode("yp_zd_manufactory", pyCode.toUpperCase() + "%"));
- }
- return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR);
- }
- public ResultVo<String> xiuGiRuKuXinXi(YpInDetl param) {
- dao.xiuGiRuKuXinXi(param);
- log.info("修改入库信息:{},修改人:{}", param, TokenUtil.getTokenUserId());
- return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "修改成功");
- }
- /* 出库的信息*/
- public ResultVo<Map<String, Object>> queryChuKuXinXi(InOrOutOfWarehousePojo param) {
- log.info("查询出库数据:{}", param);
- IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
- List<YpOutDetl> list = dao.queryChuKuXinXi(page, param);
- if (list.size() > 0) {
- Map<String, Object> map = new HashMap<>(Capacity.TWO);
- map.put("data", list);
- map.put("total", page.getTotal());
- return ResultVoUtil.success(map);
- }
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
- }
- public ResultVo<Map<String, Object>> queryDeptCode() {
- Map<String, Object> map = new HashMap<>(Capacity.TWO);
- map.put("deptCode", dao.queryDeptCode());
- map.put("groupNo", dao.queryGroupNo());
- return ResultVoUtil.success(map);
- }
- public ResultVo<String> xiuGaiChuKuXinXi(YpOutDetl param) {
- log.info("修改出库信息:{},修改人:{}", param, TokenUtil.getTokenUserId());
- dao.xiuGaiChuKu(param);
- return ResultVoUtil.success("修改成功");
- }
- }
|