Search in sources :

Example 1 with PurchaseSupplier

use of com.whoiszxl.entity.PurchaseSupplier in project shopzz by whoiszxl.

the class PurchaseSupplierController method update.

@SaCheckLogin
@PutMapping
@ApiOperation(value = "更新供应商", notes = "更新供应商", response = ResponseResult.class)
public ResponseResult<Boolean> update(@RequestBody PurchaseSupplierVO purchaseSupplierVO) {
    PurchaseSupplier purchaseSupplier = purchaseSupplierVO.clone(PurchaseSupplier.class);
    boolean updateFlag = purchaseSupplierService.updateById(purchaseSupplier);
    return ResponseResult.buildByFlag(updateFlag);
}
Also used : PurchaseSupplier(com.whoiszxl.entity.PurchaseSupplier) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with PurchaseSupplier

use of com.whoiszxl.entity.PurchaseSupplier in project shopzz by whoiszxl.

the class PurchaseSupplierController method save.

@SaCheckLogin
@PostMapping
@ApiOperation(value = "新增供应商", notes = "新增供应商", response = ResponseResult.class)
public ResponseResult<Boolean> save(@RequestBody PurchaseSupplierSaveCommand purchaseSupplierSaveCommand) {
    PurchaseSupplier purchaseSupplier = dozerUtils.map(purchaseSupplierSaveCommand, PurchaseSupplier.class);
    boolean saveFlag = purchaseSupplierService.save(purchaseSupplier);
    return ResponseResult.buildByFlag(saveFlag);
}
Also used : PurchaseSupplier(com.whoiszxl.entity.PurchaseSupplier) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 3 with PurchaseSupplier

use of com.whoiszxl.entity.PurchaseSupplier in project shopzz by whoiszxl.

the class PurchaseSupplierController method update.

@SaCheckLogin
@PutMapping
@ApiOperation(value = "更新供应商", notes = "更新供应商", response = ResponseResult.class)
public ResponseResult<Boolean> update(@RequestBody PurchaseSupplierSaveCommand purchaseSupplierSaveCommand) {
    PurchaseSupplier purchaseSupplier = dozerUtils.map(purchaseSupplierSaveCommand, PurchaseSupplier.class);
    boolean updateFlag = purchaseSupplierService.updateById(purchaseSupplier);
    return ResponseResult.buildByFlag(updateFlag);
}
Also used : PurchaseSupplier(com.whoiszxl.entity.PurchaseSupplier) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 4 with PurchaseSupplier

use of com.whoiszxl.entity.PurchaseSupplier in project shopzz by whoiszxl.

the class PurchaseSupplierController method save.

@SaCheckLogin
@PostMapping
@ApiOperation(value = "新增供应商", notes = "新增供应商", response = ResponseResult.class)
public ResponseResult<Boolean> save(@RequestBody PurchaseSupplierVO purchaseSupplierVO) {
    PurchaseSupplier purchaseSupplier = purchaseSupplierVO.clone(PurchaseSupplier.class);
    boolean saveFlag = purchaseSupplierService.save(purchaseSupplier);
    return ResponseResult.buildByFlag(saveFlag);
}
Also used : PurchaseSupplier(com.whoiszxl.entity.PurchaseSupplier) SaCheckLogin(cn.dev33.satoken.annotation.SaCheckLogin) ApiOperation(io.swagger.annotations.ApiOperation)

Example 5 with PurchaseSupplier

use of com.whoiszxl.entity.PurchaseSupplier in project shopzz by whoiszxl.

the class WeekSettlementHandler method execute.

@Override
public boolean execute() {
    // 1. 通过结算周期获取到所有的供应商
    List<PurchaseSupplier> supplierList = purchaseSupplierService.list(new LambdaQueryWrapper<PurchaseSupplier>().eq(PurchaseSupplier::getAccountPeriod, AccountPeriodConstants.WEEK));
    // 2. 遍历供应商,获取到这周的已审核的结算单
    for (PurchaseSupplier supplier : supplierList) {
        Date endTime = new Date();
        Date startTime = DateUtils.addDays(endTime, -7);
        LambdaQueryWrapper<PurchaseSettlementOrder> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(PurchaseSettlementOrder::getSupplierId, supplier.getId());
        queryWrapper.between(PurchaseSettlementOrder::getCreatedAt, startTime, endTime);
        List<PurchaseSettlementOrder> settlementOrderList = purchaseSettlementOrderService.list(queryWrapper);
        BigDecimal totalSettlementAmount = BigDecimal.ZERO;
        for (PurchaseSettlementOrder settlementOrder : settlementOrderList) {
            totalSettlementAmount = totalSettlementAmount.add(settlementOrder.getTotalSettlementAmount());
        }
        payForSupplier(supplier.getBankName(), supplier.getBankAccount(), supplier.getAccountHolder(), totalSettlementAmount);
        // 通过供应商ID更新采购单状态为已完成
        purchaseOrderService.updateFinishedBySupplierId(supplier.getId());
    }
    return true;
}
Also used : PurchaseSupplier(com.whoiszxl.entity.PurchaseSupplier) Date(java.util.Date) PurchaseSettlementOrder(com.whoiszxl.entity.PurchaseSettlementOrder) BigDecimal(java.math.BigDecimal) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Aggregations

PurchaseSupplier (com.whoiszxl.entity.PurchaseSupplier)5 SaCheckLogin (cn.dev33.satoken.annotation.SaCheckLogin)4 ApiOperation (io.swagger.annotations.ApiOperation)4 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 PurchaseSettlementOrder (com.whoiszxl.entity.PurchaseSettlementOrder)1 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1