dev
This commit is contained in:
parent
07ba02f73c
commit
7e91801a59
|
|
@ -1,28 +1,15 @@
|
||||||
package com.syjiaer.clinic.server.controller;
|
package com.syjiaer.clinic.server.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.syjiaer.clinic.server.common.exception.VerifyException;
|
|
||||||
import com.syjiaer.clinic.server.common.util.HeadersUtil;
|
import com.syjiaer.clinic.server.common.util.HeadersUtil;
|
||||||
import com.syjiaer.clinic.server.common.util.InfoUtil;
|
import com.syjiaer.clinic.server.common.util.InfoUtil;
|
||||||
import com.syjiaer.clinic.server.common.util.ParmsUtil;
|
import com.syjiaer.clinic.server.common.util.ParmsUtil;
|
||||||
import com.syjiaer.clinic.server.common.vo.Page;
|
|
||||||
import com.syjiaer.clinic.server.common.vo.Result;
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
import io.jsonwebtoken.Jws;
|
|
||||||
import io.jsonwebtoken.JwtException;
|
|
||||||
import io.jsonwebtoken.Jwts;
|
|
||||||
import io.jsonwebtoken.security.Keys;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class BaseController {
|
public abstract class BaseController {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.syjiaer.clinic.server.controller.inventory;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
|
import com.syjiaer.clinic.server.controller.BaseController;
|
||||||
|
import com.syjiaer.clinic.server.entity.inventory.Inventory;
|
||||||
|
import com.syjiaer.clinic.server.service.goods.GoodsService;
|
||||||
|
import com.syjiaer.clinic.server.service.inventory.InventoryPurchaseService;
|
||||||
|
import com.syjiaer.clinic.server.service.inventory.InventoryService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inventory/goods")
|
||||||
|
public class InventoryController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private GoodsService iGoodsService;
|
||||||
|
@Autowired
|
||||||
|
private InventoryPurchaseService iInventoryPurchaseService;
|
||||||
|
@Autowired
|
||||||
|
private InventoryService iInventoryService;
|
||||||
|
/**
|
||||||
|
*根据采购单code 获取采购单信息
|
||||||
|
*/
|
||||||
|
@RequestMapping("/listByOrderCode")
|
||||||
|
public Result<List<Inventory>> listByOrderCode() {
|
||||||
|
String orderCode = parmsUtil.getString("orderCode", "请输入订单号");
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.eq("inventory_purchase_code", orderCode);
|
||||||
|
return success(iInventoryService.list(queryWrapper));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.syjiaer.clinic.server.entity.inventory;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author NiuZiYuan
|
||||||
|
* @since 2025-03-10
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("inventory_goods_view")
|
||||||
|
@ApiModel(value = "InventoryGoodsView对象", description = "")
|
||||||
|
public class InventoryGoodsView implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer wholeNumber;
|
||||||
|
|
||||||
|
private Integer fragmentNumber;
|
||||||
|
|
||||||
|
private BigDecimal purchaseUnitPrice;
|
||||||
|
|
||||||
|
private LocalDateTime createDatetime;
|
||||||
|
|
||||||
|
private String inventoryPurchaseCode;
|
||||||
|
|
||||||
|
private Integer goodId;
|
||||||
|
|
||||||
|
private String packagingUnit;
|
||||||
|
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
private LocalDate expiryDate;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String productionBatchCode;
|
||||||
|
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,9 @@ import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class InventoryPurchaseService {
|
public class InventoryPurchaseService {
|
||||||
|
|
@ -31,6 +33,8 @@ public class InventoryPurchaseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryMapper inventoryMapper;
|
private InventoryMapper inventoryMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private InventoryService inventoryService;
|
||||||
|
@Autowired
|
||||||
private InventoryLogMapper inventoryLogMapper;
|
private InventoryLogMapper inventoryLogMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryInitMapper inventoryInitMapper;
|
private InventoryInitMapper inventoryInitMapper;
|
||||||
|
|
@ -38,6 +42,11 @@ public class InventoryPurchaseService {
|
||||||
private InventoryPurchaseMapper inventoryPurchaseMapper;
|
private InventoryPurchaseMapper inventoryPurchaseMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
private InventoryPurchaseLogMapper inventoryPurchaseLogMapper;
|
||||||
|
/*
|
||||||
|
* 创建采购订单
|
||||||
|
* @param inventoryPurchase 采购订单
|
||||||
|
* @param list 采购项
|
||||||
|
*/
|
||||||
public void create(InventoryPurchase inventoryPurchase, List<Inventory> list) {
|
public void create(InventoryPurchase inventoryPurchase, List<Inventory> list) {
|
||||||
if (inventoryPurchase.getInvoiceCode() == null || inventoryPurchase.getInvoiceCode().isEmpty()) {
|
if (inventoryPurchase.getInvoiceCode() == null || inventoryPurchase.getInvoiceCode().isEmpty()) {
|
||||||
inventoryPurchase.setInvoiceCode("无");
|
inventoryPurchase.setInvoiceCode("无");
|
||||||
|
|
@ -52,6 +61,11 @@ public class InventoryPurchaseService {
|
||||||
}
|
}
|
||||||
createOrder(inventoryPurchase, list);
|
createOrder(inventoryPurchase, list);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* 创建采购订单
|
||||||
|
* @param inventoryOrder 采购订单
|
||||||
|
* @param list 采购项
|
||||||
|
*/
|
||||||
public void createOrder(InventoryPurchase inventoryOrder, List<Inventory> list) {
|
public void createOrder(InventoryPurchase inventoryOrder, List<Inventory> list) {
|
||||||
//构造订单
|
//构造订单
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
|
@ -152,27 +166,10 @@ public class InventoryPurchaseService {
|
||||||
goodsService.updateInventoryInfoById(inventory.getGoodId());
|
goodsService.updateInventoryInfoById(inventory.getGoodId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// public Page<> list(int pageNum, int pageSize) {
|
/*
|
||||||
// QueryWrapper<InventoryPurchaseView> queryWrapper = new QueryWrapper<>();
|
* 创建采购订单
|
||||||
// if (query.getPageNum() == null || query.getPageNum() == 0) {
|
* @param inventory 库存信息
|
||||||
// query.setPageNum(1);
|
*/
|
||||||
// }
|
|
||||||
// if (query.getPageSize() == null || query.getPageSize() == 0) {
|
|
||||||
// query.setPageSize(Constants.DetailPageSize);
|
|
||||||
// }
|
|
||||||
// long totalCount = iInventoryPurchaseViewService.count(queryWrapper);
|
|
||||||
// int totalPage = (int) Math.ceil((double) totalCount / query.getPageSize());
|
|
||||||
// int offset = (query.getPageNum() - 1) * query.getPageSize();
|
|
||||||
// Integer limit = query.getPageSize();
|
|
||||||
// queryWrapper.orderByDesc("create_datetime");
|
|
||||||
// queryWrapper.last("limit " + limit + " offset " + offset);
|
|
||||||
// Page page = new Page();
|
|
||||||
// page.setTotal_count(totalCount);
|
|
||||||
// page.setTotal_page(totalPage);
|
|
||||||
// List<InventoryPurchaseView> InventoryPurchaseView = iInventoryPurchaseViewService.list(queryWrapper);
|
|
||||||
// page.setList(InventoryPurchaseView);
|
|
||||||
// return success(page);
|
|
||||||
// }
|
|
||||||
public void addOneGoods(Inventory inventory) {
|
public void addOneGoods(Inventory inventory) {
|
||||||
QueryWrapper<InventoryPurchase> orderWrapper = new QueryWrapper();
|
QueryWrapper<InventoryPurchase> orderWrapper = new QueryWrapper();
|
||||||
orderWrapper.eq("code", inventory.getInventoryPurchaseCode());
|
orderWrapper.eq("code", inventory.getInventoryPurchaseCode());
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,7 @@ import com.syjiaer.clinic.server.common.exception.MessageException;
|
||||||
import com.syjiaer.clinic.server.common.util.DateUtil;
|
import com.syjiaer.clinic.server.common.util.DateUtil;
|
||||||
import com.syjiaer.clinic.server.common.vo.Result;
|
import com.syjiaer.clinic.server.common.vo.Result;
|
||||||
import com.syjiaer.clinic.server.entity.goods.Goods;
|
import com.syjiaer.clinic.server.entity.goods.Goods;
|
||||||
import com.syjiaer.clinic.server.entity.inventory.Inventory;
|
import com.syjiaer.clinic.server.entity.inventory.*;
|
||||||
import com.syjiaer.clinic.server.entity.inventory.InventoryLog;
|
|
||||||
import com.syjiaer.clinic.server.entity.inventory.InventoryPurchase;
|
|
||||||
import com.syjiaer.clinic.server.entity.inventory.InventoryPurchaseLog;
|
|
||||||
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
import com.syjiaer.clinic.server.entity.manager.ManagerUser;
|
||||||
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
import com.syjiaer.clinic.server.mapper.goods.GoodsMapper;
|
||||||
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
import com.syjiaer.clinic.server.mapper.inventory.InventoryLogMapper;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue