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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations