Skip to content

Commit

Permalink
Merge pull request #191 from Jzow/master
Browse files Browse the repository at this point in the history
add edit views in retail receipt
  • Loading branch information
wansenai-bot authored Nov 13, 2023
2 parents 2286f16 + d61d26c commit 2ee633f
Show file tree
Hide file tree
Showing 18 changed files with 597 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public Response<RetailShipmentsDetailVO> detail(@PathVariable("id") Long id) {
return receiptRetailService.getRetailShipmentsDetail(id);
}

@GetMapping("/shipments/getLinkShipmentDetail/{otherReceipt}")
public Response<RetailShipmentsDetailVO> getLinkShipmentDetail(@PathVariable("otherReceipt") String otherReceipt) {
return receiptRetailService.getLinkRetailShipmentsDetail(otherReceipt);
}

@PostMapping("/refund/pageList")
public Response<Page<RetailRefundVO>> refundPageList(@RequestBody QueryRetailRefundDTO refundDTO) {
return receiptRetailService.getRetailRefund(refundDTO);
Expand All @@ -82,6 +87,11 @@ public Response<RetailRefundDetailVO> refundDetail(@PathVariable("id") Long id)
return receiptRetailService.getRetailRefundDetail(id);
}

@GetMapping("/refund/getLinkRefundDetail/{otherReceipt}")
public Response<RetailRefundDetailVO> getLinkRefundDetail(@PathVariable("otherReceipt") String otherReceipt) {
return receiptRetailService.getLinkRetailRefundDetail(otherReceipt);
}

@PostMapping("/refund/deleteByIds")
public Response<String> refundDeleteByIds(@RequestParam("ids") List<Long> ids) {
return receiptRetailService.deleteRetailRefund(ids);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class ShipmentsDataBO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long warehouseId;

private String warehouseName;

private String productCode;

@JsonFormat(shape = JsonFormat.Shape.STRING)
Expand All @@ -29,6 +31,10 @@ public class ShipmentsDataBO {

private String productUnit;

private String productModel;

private String productColor;

private String productStandard;

private Integer stock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ public class RetailRefundDetailVO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long memberId;

private String memberName;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long accountId;

private String accountName;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;

private String receiptNumber;

private String otherReceipt;

private String paymentType;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal paymentAmount;

Expand All @@ -55,4 +61,6 @@ public class RetailRefundDetailVO {
private List<ShipmentsDataBO> tableData;

private List<FileDataBO> files;

private Integer status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public class RetailShipmentsDetailVO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long memberId;

private String memberName;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long accountId;

private String accountName;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;

Expand All @@ -55,4 +59,6 @@ public class RetailShipmentsDetailVO {
private List<ShipmentsDataBO> tableData;

private List<FileDataBO> files;

private Integer status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ public interface CommonService {
Response<String> generateSnowflakeId(String type);

List<FileDataBO> getFileList(String fileId);

String getWarehouseName(Long warehouseId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ public List<FileDataBO> getFileList(String fileId) {
return fileList;
}

@Override
public String getWarehouseName(Long warehouseId) {
return warehouseService.getById(warehouseId).getWarehouseName();
}

private String getCellValue(Cell cell, DataFormatter dataFormatter) {
if (cell != null) {
String value = dataFormatter.formatCellValue(cell);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ public interface ReceiptRetailService extends IService<ReceiptRetailMain> {
*/
Response<RetailShipmentsDetailVO> getRetailShipmentsDetail(Long id);

/**
* Query the detailed data of shipment receipt based on the associated document number
* 根据关联单号查询出库单详情数据
*
* @param receiptNumber associated document number
* 关联单号
* @return Returns the detailed data of the shipment receipt
* 返回出库单详情数据
*/
Response<RetailShipmentsDetailVO> getLinkRetailShipmentsDetail(String receiptNumber);

/**
* According to the id collection and status, the status of the retail shipment order is modified in batches.
* <p>
Expand Down Expand Up @@ -140,6 +151,17 @@ public interface ReceiptRetailService extends IService<ReceiptRetailMain> {
*/
Response<RetailRefundDetailVO> getRetailRefundDetail(Long id);

/**
* Query return receipt details data based on return order number
* 根据退货单号查询退货单详情数据
*
* @param otherReceipt Return order number
* 退货单号
* @return Return order details data
* 退货单详情数据
*/
Response<RetailRefundDetailVO> getLinkRetailRefundDetail(String otherReceipt);

/**
* Delete retail return document data based on ID
* 根据id删除零售退货单据数据
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.wansenai.mappers.system.SysFileMapper;
import com.wansenai.service.basic.MemberService;
import com.wansenai.service.common.CommonService;
import com.wansenai.service.financial.IFinancialAccountService;
import com.wansenai.service.product.ProductService;
import com.wansenai.service.receipt.ReceiptRetailService;
import com.wansenai.service.receipt.ReceiptRetailSubService;
Expand Down Expand Up @@ -69,6 +70,8 @@ public class ReceiptRetailServiceImpl extends ServiceImpl<ReceiptRetailMainMappe

private final MemberService memberService;

private final IFinancialAccountService accountService;

private final ISysUserService userService;

private final SysFileMapper fileMapper;
Expand All @@ -81,10 +84,12 @@ public class ReceiptRetailServiceImpl extends ServiceImpl<ReceiptRetailMainMappe

private final CommonService commonService;

public ReceiptRetailServiceImpl(ReceiptRetailMainMapper receiptRetailMainMapper, ReceiptRetailSubService receiptRetailSubService, MemberService memberService, ISysUserService userService, SysFileMapper fileMapper, ProductStockKeepUnitMapper productStockKeepUnitMapper, ProductStockMapper productStockMapper, ProductService productService, CommonService commonService) {

public ReceiptRetailServiceImpl(ReceiptRetailMainMapper receiptRetailMainMapper, ReceiptRetailSubService receiptRetailSubService, MemberService memberService, IFinancialAccountService accountService, ISysUserService userService, SysFileMapper fileMapper, ProductStockKeepUnitMapper productStockKeepUnitMapper, ProductStockMapper productStockMapper, ProductService productService, CommonService commonService) {
this.receiptRetailMainMapper = receiptRetailMainMapper;
this.receiptRetailSubService = receiptRetailSubService;
this.memberService = memberService;
this.accountService = accountService;
this.userService = userService;
this.fileMapper = fileMapper;
this.productStockKeepUnitMapper = productStockKeepUnitMapper;
Expand All @@ -97,6 +102,10 @@ private String getMemberName(Long memberId) {
return (memberId != null) ? memberService.getById(memberId).getMemberName() : null;
}

private String getAccountName(Long accountId) {
return (accountId != null) ? accountService.getById(accountId).getAccountName() : null;
}

private String getUserName(Long userId) {
return (userId != null) ? userService.getById(userId).getName() : null;
}
Expand Down Expand Up @@ -196,10 +205,17 @@ private ShipmentsDataBO createShipmentsDataFromReceiptSub(ReceiptRetailSub item)
.build();
var data = productStockKeepUnitMapper.getProductSkuByBarCode(item.getProductBarcode(), item.getWarehouseId());
if (data != null) {
shipmentBo.setWarehouseId(data.getWarehouseId());
shipmentBo.setProductName(data.getProductName());
shipmentBo.setProductStandard(data.getProductStandard());
shipmentBo.setProductUnit(data.getProductUnit());
shipmentBo.setProductModel(data.getProductModel());
shipmentBo.setProductColor(data.getProductColor());
shipmentBo.setStock(data.getStock());

if (data.getWarehouseId() != null) {
shipmentBo.setWarehouseName(commonService.getWarehouseName(data.getWarehouseId()));
}
}
return shipmentBo;
}
Expand Down Expand Up @@ -448,27 +464,22 @@ public Response<String> deleteRetailShipments(List<Long> ids) {
return deleteRetail(ids, RetailCodeEnum.DELETE_RETAIL_SHIPMENTS_SUCCESS, RetailCodeEnum.DELETE_RETAIL_SHIPMENTS_ERROR);
}

@Override
public Response<RetailShipmentsDetailVO> getRetailShipmentsDetail(Long id) {
if (id == null) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var shipment = getById(id);
private RetailShipmentsDetailVO createRetailShipmentsDetail(ReceiptRetailMain shipment) {
var fileList = commonService.getFileList(shipment.getFileId());
var receiptSubList = receiptRetailSubService.lambdaQuery()
.eq(ReceiptRetailSub::getReceiptMainId, id)
.eq(ReceiptRetailSub::getReceiptMainId, shipment.getId())
.list();

var tableData = new ArrayList<ShipmentsDataBO>(receiptSubList.size() + 1);
for (ReceiptRetailSub item : receiptSubList) {
var shipmentBo = createShipmentsDataFromReceiptSub(item);
tableData.add(shipmentBo);
}
var tableData = receiptSubList.stream()
.map(this::createShipmentsDataFromReceiptSub)
.collect(Collectors.toCollection(ArrayList::new));

var retailShipmentsDetailVO = RetailShipmentsDetailVO.builder()
return RetailShipmentsDetailVO.builder()
.receiptNumber(shipment.getReceiptNumber())
.receiptDate(shipment.getReceiptDate())
.memberId(shipment.getMemberId())
.memberName(getMemberName(shipment.getMemberId()))
.accountName(getAccountName(shipment.getAccountId()))
.accountId(shipment.getAccountId())
.paymentType(shipment.getPaymentType())
.collectAmount(shipment.getChangeAmount())
Expand All @@ -477,8 +488,30 @@ public Response<RetailShipmentsDetailVO> getRetailShipmentsDetail(Long id) {
.remark(shipment.getRemark())
.tableData(tableData)
.files(fileList)
.status(shipment.getStatus())
.build();
}

@Override
public Response<RetailShipmentsDetailVO> getRetailShipmentsDetail(Long id) {
if (id == null) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var shipment = getById(id);
var retailShipmentsDetailVO = createRetailShipmentsDetail(shipment);
return Response.responseData(retailShipmentsDetailVO);
}

@Override
public Response<RetailShipmentsDetailVO> getLinkRetailShipmentsDetail(String receiptNumber) {
if (!StringUtils.hasLength(receiptNumber)) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var shipment = lambdaQuery()
.eq(ReceiptRetailMain::getReceiptNumber, receiptNumber)
.eq(ReceiptRetailMain::getDeleteFlag, CommonConstants.NOT_DELETED)
.one();
var retailShipmentsDetailVO = createRetailShipmentsDetail(shipment);
return Response.responseData(retailShipmentsDetailVO);
}

Expand Down Expand Up @@ -692,38 +725,56 @@ public Response<List<ReceiptRetailDetailVO>> retailDetail(Long id) {
return Response.responseData(result);
}

@Override
public Response<RetailRefundDetailVO> getRetailRefundDetail(Long id) {
if (id == null) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var refund = getById(id);
private RetailRefundDetailVO createRetailRefundDetail(ReceiptRetailMain refund) {
var fileList = commonService.getFileList(refund.getFileId());
var receiptSubList = receiptRetailSubService.lambdaQuery()
.eq(ReceiptRetailSub::getReceiptMainId, id)
.eq(ReceiptRetailSub::getReceiptMainId, refund.getId())
.eq(ReceiptRetailSub::getDeleteFlag, CommonConstants.NOT_DELETED)
.list();

var tableData = new ArrayList<ShipmentsDataBO>(receiptSubList.size() + 1);
for (ReceiptRetailSub item : receiptSubList) {
var shipmentBo = createShipmentsDataFromReceiptSub(item);
tableData.add(shipmentBo);
}
var tableData = receiptSubList.stream()
.map(this::createShipmentsDataFromReceiptSub)
.collect(Collectors.toCollection(ArrayList::new));

var retailRefundDetailVO = RetailRefundDetailVO.builder()
return RetailRefundDetailVO.builder()
.receiptNumber(refund.getReceiptNumber())
.receiptDate(refund.getReceiptDate())
.memberId(refund.getMemberId())
.memberName(getMemberName(refund.getMemberId()))
.accountId(refund.getAccountId())
.accountName(getAccountName(refund.getAccountId()))
.otherReceipt(refund.getOtherReceipt())
.paymentAmount(refund.getChangeAmount())
.paymentType(refund.getPaymentType())
.receiptAmount(refund.getTotalAmount())
.backAmount(refund.getBackAmount())
.remark(refund.getRemark())
.tableData(tableData)
.files(fileList)
.status(refund.getStatus())
.build();
}

@Override
public Response<RetailRefundDetailVO> getRetailRefundDetail(Long id) {
if (id == null) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var refund = getById(id);
var retailRefundDetailVO = createRetailRefundDetail(refund);
return Response.responseData(retailRefundDetailVO);
}

@Override
public Response<RetailRefundDetailVO> getLinkRetailRefundDetail(String receiptNumber) {
if (!StringUtils.hasLength(receiptNumber)) {
return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL);
}
var refund = lambdaQuery()
.eq(ReceiptRetailMain::getReceiptNumber, receiptNumber)
.eq(ReceiptRetailMain::getDeleteFlag, CommonConstants.NOT_DELETED)
.one();
var retailRefundDetailVO = createRetailRefundDetail(refund);
return Response.responseData(retailRefundDetailVO);
}

Expand Down
18 changes: 18 additions & 0 deletions web/src/api/retail/model/refundModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ export interface AddOrUpdateRefundReq {
files: FileData[];
}

export interface AddOrUpdateRefundResp {
id: number | string | undefined;
memberId: string;
memberName: string;
accountId: string;
accountName: string;
receiptDate: string;
receiptNumber: string;
otherReceipt: string;
paymentAmount: number;
receiptAmount: number;
backAmount: number;
remark: string;
status: number;
tableData: ShipmentsData[];
files: FileData[];
}

export interface RefundResp {
id: number | string;
memberName: string;
Expand Down
18 changes: 18 additions & 0 deletions web/src/api/retail/model/shipmentsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ export interface AddOrUpdateShipmentsReq {
fileDataList: FileData[];
}

export interface AddOrUpdateShipmentsResp {
id: number | string | undefined;
memberId: number | string;
memberName: string;
accountId: number | string;
accountName: string;
receiptDate: string;
receiptNumber: string;
receiptType: string;
collectionAmount: number;
receiptAmount: number;
backAmount: number;
remark: string;
status: number;
tableData: ShipmentsData[];
fileDataList: FileData[];
}

export interface QueryShipmentsReq {
receiptNumber: string;
productInfo: string;
Expand Down
Loading

0 comments on commit 2ee633f

Please sign in to comment.