Commit f86e3c65 by 杨浩

bug调整

parent cc58b6b0
...@@ -154,6 +154,7 @@ public class ErpSaleOrderController { ...@@ -154,6 +154,7 @@ public class ErpSaleOrderController {
if (CommonUtil.isNotEmpty(saleOrderVO.getDeliveryStaffId())) { if (CommonUtil.isNotEmpty(saleOrderVO.getDeliveryStaffId())) {
saleOrderVO.setDeliveryStaffInfo(deliveryStaffApi.querybyStaffId(saleOrderVO.getDeliveryStaffId())); saleOrderVO.setDeliveryStaffInfo(deliveryStaffApi.querybyStaffId(saleOrderVO.getDeliveryStaffId()));
} }
saleOrderVO.setCustomerName(Optional.ofNullable(customerService.getCustomer(saleOrderVO.getCustomerId())).map(ErpCustomerDO::getName).orElse(""));
saleOrderVO.setItems(BeanUtils.toBean(saleOrderItemList, ErpSaleOrderRespVO.Item.class, item -> { saleOrderVO.setItems(BeanUtils.toBean(saleOrderItemList, ErpSaleOrderRespVO.Item.class, item -> {
MapUtils.findAndThen(supplierMap, item.getSupplierId(), item::setSupplierName); MapUtils.findAndThen(supplierMap, item.getSupplierId(), item::setSupplierName);
MapUtils.findAndThen(purchaseOrderMap, item.getPurchaseOrderId(), purchaseOrder -> MapUtils.findAndThen(purchaseOrderMap, item.getPurchaseOrderId(), purchaseOrder ->
......
...@@ -163,4 +163,5 @@ public interface ErpSaleOrderService { ...@@ -163,4 +163,5 @@ public interface ErpSaleOrderService {
*/ */
List<DeliveryStatusCountRespVO> statusCount(Long userId, Set<Long> deptIds); List<DeliveryStatusCountRespVO> statusCount(Long userId, Set<Long> deptIds);
void update(ErpSaleOrderDO updateSaleOrder, List<ErpSaleOrderItemDO> updateSaleOrderItems);
} }
\ No newline at end of file
...@@ -700,4 +700,16 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { ...@@ -700,4 +700,16 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
return result; return result;
} }
@Override
public void update(ErpSaleOrderDO updateSaleOrder, List<ErpSaleOrderItemDO> updateSaleOrderItems) {
saleOrderMapper.updateById(updateSaleOrder);
if (CommonUtil.isNotEmpty(updateSaleOrderItems)) {
saleOrderItemMapper.updateBatch(updateSaleOrderItems);
} else {
saleOrderItemMapper.update(Wrappers.<ErpSaleOrderItemDO>lambdaUpdate()
.set(ErpSaleOrderItemDO::getPickUpStatus, updateSaleOrder.getPickUpStatus())
.eq(ErpSaleOrderItemDO::getOrderId, updateSaleOrder.getId()));
}
}
} }
...@@ -105,9 +105,9 @@ public interface ErpSaleReturnService { ...@@ -105,9 +105,9 @@ public interface ErpSaleReturnService {
*/ */
ErpSaleReturnDO queryByCustomerOrderId(Long id); ErpSaleReturnDO queryByCustomerOrderId(Long id);
void accept(Long id, Long deliveryStaffId); void accept(Long saleOrderId, Long deliveryStaffId);
void delivery(Long id, Long deliveryStaffId); void delivery(Long saleOrderId, Long deliveryStaffId);
void arrival(DeliveryOrderUpdateReqVO reqVO, Long aLong); void arrival(DeliveryOrderUpdateReqVO reqVO, Long aLong);
......
...@@ -257,6 +257,12 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService { ...@@ -257,6 +257,12 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
customerOrderApi.updateActualAmount(saleReturn.getCustomerOrderId(), - returnsTotal); customerOrderApi.updateActualAmount(saleReturn.getCustomerOrderId(), - returnsTotal);
customerOrderApi.updateItems(updateItems); customerOrderApi.updateItems(updateItems);
// 销售订单状态变更
ErpSaleOrderDO updateSaleOrder = new ErpSaleOrderDO();
updateSaleOrder.setId(saleReturn.getOrderId());
updateSaleOrder.setPickUpStatus(RETURNS_APPROVE);
saleOrderService.update(updateSaleOrder, null);
// TODO 退款确认后才进行库存变更 // TODO 退款确认后才进行库存变更
/*Integer bizType = approve ? ErpStockRecordBizTypeEnum.SALE_RETURN.getType() /*Integer bizType = approve ? ErpStockRecordBizTypeEnum.SALE_RETURN.getType()
: ErpStockRecordBizTypeEnum.SALE_RETURN_CANCEL.getType(); : ErpStockRecordBizTypeEnum.SALE_RETURN_CANCEL.getType();
...@@ -419,6 +425,19 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService { ...@@ -419,6 +425,19 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
return saleReturn; return saleReturn;
} }
private ErpSaleReturnDO validateBySaleOrderId(Long saleOrderId) {
ErpSaleReturnDO saleReturn = saleReturnMapper.selectOne(Wrappers.<ErpSaleReturnDO>lambdaQuery()
.eq(ErpSaleReturnDO::getOrderId, saleOrderId)
.last("LIMIT 1"));
if (saleReturn == null) {
throw exception(SALE_RETURN_NOT_EXISTS);
}
if (ObjectUtil.notEqual(saleReturn.getStatus(), ErpAuditStatus.APPROVE.getStatus())) {
throw exception(SALE_RETURN_NOT_APPROVE);
}
return saleReturn;
}
@Override @Override
public PageResult<ErpSaleReturnDO> getSaleReturnPage(ErpSaleReturnPageReqVO pageReqVO) { public PageResult<ErpSaleReturnDO> getSaleReturnPage(ErpSaleReturnPageReqVO pageReqVO) {
return saleReturnMapper.selectPage(pageReqVO); return saleReturnMapper.selectPage(pageReqVO);
...@@ -454,9 +473,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService { ...@@ -454,9 +473,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void accept(Long id, Long deliveryStaffId) { public void accept(Long saleOrderId, Long deliveryStaffId) {
ErpSaleReturnDO saleReturn = validateSaleReturn(id); ErpSaleOrderDO saleOrder = saleOrderService.validateSaleOrder(saleOrderId);
ErpSaleOrderDO saleOrder = saleOrderService.validateSaleOrder(saleReturn.getOrderId()); ErpSaleReturnDO saleReturn = validateBySaleOrderId(saleOrderId);
if (!saleReturn.getReturnsStatus().equals(RETURNS_APPROVE.getType()) || !saleOrder.getPickUpStatus().equals(RETURNS_APPROVE)) { if (!saleReturn.getReturnsStatus().equals(RETURNS_APPROVE.getType()) || !saleOrder.getPickUpStatus().equals(RETURNS_APPROVE)) {
throw exception(SALE_ORDER_PICKUP_STATUS_FAIL); throw exception(SALE_ORDER_PICKUP_STATUS_FAIL);
...@@ -490,9 +509,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService { ...@@ -490,9 +509,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delivery(Long id, Long deliveryStaffId) { public void delivery(Long saleOrderId, Long deliveryStaffId) {
ErpSaleReturnDO saleReturn = validateSaleReturn(id); ErpSaleOrderDO saleOrder = saleOrderService.validateSaleOrder(saleOrderId);
ErpSaleOrderDO saleOrder = saleOrderService.validateSaleOrder(saleReturn.getOrderId()); ErpSaleReturnDO saleReturn = validateBySaleOrderId(saleOrderId);
if (!saleReturn.getReturnsStatus().equals(RETURNS_STAFF_ACCEPT.getType()) || !saleOrder.getPickUpStatus().equals(RETURNS_STAFF_ACCEPT)) { if (!saleReturn.getReturnsStatus().equals(RETURNS_STAFF_ACCEPT.getType()) || !saleOrder.getPickUpStatus().equals(RETURNS_STAFF_ACCEPT)) {
throw exception(SALE_ORDER_PICKUP_STATUS_FAIL); throw exception(SALE_ORDER_PICKUP_STATUS_FAIL);
......
...@@ -86,15 +86,16 @@ public class FileTypeUtils { ...@@ -86,15 +86,16 @@ public class FileTypeUtils {
if (StrUtil.containsIgnoreCase(contentType, "image/")) { if (StrUtil.containsIgnoreCase(contentType, "image/")) {
// 参见 https://github.com/YunaiV/ruoyi-vue-pro/issues/692 讨论 // 参见 https://github.com/YunaiV/ruoyi-vue-pro/issues/692 讨论
response.setHeader("Content-Disposition", "inline;filename=" + HttpUtils.encodeUtf8(filename)); response.setHeader("Content-Disposition", "inline;filename=" + HttpUtils.encodeUtf8(filename));
} else { }// 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题
response.setHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename)); else if (StrUtil.containsIgnoreCase(contentType, "video")) {
} response.setHeader("Content-Disposition", "inline;filename=" + HttpUtils.encodeUtf8(filename));
// 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题
if (StrUtil.containsIgnoreCase(contentType, "video")) {
response.setHeader("Content-Length", String.valueOf(content.length)); response.setHeader("Content-Length", String.valueOf(content.length));
response.setHeader("Content-Range", "bytes 0-" + (content.length - 1) + "/" + content.length); response.setHeader("Content-Range", "bytes 0-" + (content.length - 1) + "/" + content.length);
response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Accept-Ranges", "bytes");
} else {
response.setHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename));
} }
// 输出附件 // 输出附件
IoUtil.write(response.getOutputStream(), false, content); IoUtil.write(response.getOutputStream(), false, content);
} }
......
...@@ -98,9 +98,9 @@ public class SupplierPurchaseOrderController { ...@@ -98,9 +98,9 @@ public class SupplierPurchaseOrderController {
purchaseOrder.setPlanDeliveryStartTime(customerOrder.getPlanDeliveryStartTime()); purchaseOrder.setPlanDeliveryStartTime(customerOrder.getPlanDeliveryStartTime());
purchaseOrder.setPlanDeliveryEndTime(customerOrder.getPlanDeliveryEndTime()); purchaseOrder.setPlanDeliveryEndTime(customerOrder.getPlanDeliveryEndTime());
// TODO 待定 // TODO 待定
// purchaseOrder.setPayablePrice();
purchaseOrder.setSignedTotal(customerOrderItemDOS.stream().mapToInt(CustomerOrderItemDO::getSignedTotal).sum()); purchaseOrder.setSignedTotal(customerOrderItemDOS.stream().mapToInt(CustomerOrderItemDO::getSignedTotal).sum());
purchaseOrder.setReturnsTotal(customerOrderItemDOS.stream().mapToInt(CustomerOrderItemDO::getReturnsTotal).sum()); purchaseOrder.setReturnsTotal(customerOrderItemDOS.stream().mapToInt(CustomerOrderItemDO::getReturnsTotal).sum());
purchaseOrder.setPayablePrice(CommonUtil.getEls(purchaseOrder.getSignedTotal(), 0) - CommonUtil.getEls(purchaseOrder.getReturnsTotal(), 0));
purchaseOrder.setSupplierName(customerOrderItemDOS.get(0).getSupplierName()); purchaseOrder.setSupplierName(customerOrderItemDOS.get(0).getSupplierName());
StringBuilder productNames = new StringBuilder(); StringBuilder productNames = new StringBuilder();
......
...@@ -50,10 +50,16 @@ public class AppCustomerOrderReconciliationController { ...@@ -50,10 +50,16 @@ public class AppCustomerOrderReconciliationController {
@GetMapping("/page-year") @GetMapping("/page-year")
@Operation(summary = "分页获取月度账单(按年份)") @Operation(summary = "分页获取月度账单(按年份)")
public CommonResult<AppCustomerMonthOrderRespVO> pageYear(@Valid AppCustomerYearOrderPageReqVO reqVO) { public CommonResult<AppCustomerMonthOrderRespVO> pageYear(@Valid AppCustomerYearOrderPageReqVO reqVO) {
reqVO.setDeptIds(customerApi.queryCustomerDeptIdsByUserId(getLoginUserId())); // reqVO.setDeptIds(customerApi.queryCustomerDeptIdsByUserId(getLoginUserId()));
if (CommonUtil.isEmpty(reqVO.getDeptIds())) { Pair<Boolean, Set<Long>> pair = customerApi.queryCustomerOrUserByUserId(getLoginUserId());
if (pair.getKey()) {
if (CommonUtil.isEmpty(pair.getValue())) {
return success(null); return success(null);
} }
reqVO.setDeptIds(pair.getValue());
} else {
reqVO.setCreator(getLoginUserId());
}
return success(customerOrderService.reconciliationPageYear(reqVO)); return success(customerOrderService.reconciliationPageYear(reqVO));
} }
...@@ -61,8 +67,17 @@ public class AppCustomerOrderReconciliationController { ...@@ -61,8 +67,17 @@ public class AppCustomerOrderReconciliationController {
@Operation(summary = "分页获取客户订单(按月份)") @Operation(summary = "分页获取客户订单(按月份)")
@Parameter(name = "yearMonth", description = "年月(yyyy-MM)", required = true) @Parameter(name = "yearMonth", description = "年月(yyyy-MM)", required = true)
public CommonResult<AppCustomerMonthOrderTotalRespVO> monthTotal(@RequestParam("yearMonth") String yearMonth) { public CommonResult<AppCustomerMonthOrderTotalRespVO> monthTotal(@RequestParam("yearMonth") String yearMonth) {
Set<Long> deptIds = customerApi.queryCustomerDeptIdsByUserId(getLoginUserId()); // Set<Long> deptIds = customerApi.queryCustomerDeptIdsByUserId(getLoginUserId());
return success(customerOrderService.monthTotal(yearMonth, deptIds)); Pair<Boolean, Set<Long>> pair = customerApi.queryCustomerOrUserByUserId(getLoginUserId());
if (pair.getKey()) {
if (CommonUtil.isEmpty(pair.getValue())) {
return success(null);
}
return success(customerOrderService.monthTotal(yearMonth, pair.getValue(), null));
} else {
return success(customerOrderService.monthTotal(yearMonth, null, getLoginUserId()));
}
} }
@PostMapping("/confirm") @PostMapping("/confirm")
......
...@@ -25,6 +25,9 @@ public class AppCustomerYearOrderPageReqVO extends PageParam { ...@@ -25,6 +25,9 @@ public class AppCustomerYearOrderPageReqVO extends PageParam {
@Schema(description = "客户灶点集合", hidden = true) @Schema(description = "客户灶点集合", hidden = true)
private Set<Long> deptIds; private Set<Long> deptIds;
@Schema(description = "用户id", hidden = true)
private Long creator;
/*@Schema(description = "月份(1-12)") /*@Schema(description = "月份(1-12)")
@Max(value = 12, message = "异常月份") @Max(value = 12, message = "异常月份")
@Min(value = 1, message = "异常月份") @Min(value = 1, message = "异常月份")
......
...@@ -89,7 +89,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> { ...@@ -89,7 +89,7 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
return this.selectMaps(queryWrapper); return this.selectMaps(queryWrapper);
} }
default AppCustomerMonthOrderRespVO reconciliationPageYearTotal(String year, Set<Long> deptIds) { default AppCustomerMonthOrderRespVO reconciliationPageYearTotal(String year, Set<Long> deptIds, Long creator) {
year = year.trim(); year = year.trim();
String begin = year + "-01-01 00:00:00"; String begin = year + "-01-01 00:00:00";
String end = year + "-12-31 23:59:59"; String end = year + "-12-31 23:59:59";
...@@ -99,7 +99,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> { ...@@ -99,7 +99,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(), queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(),
CustomerOrderStatus.FINISH.getKey(), CustomerOrderStatus.FINISH.getKey(),
CustomerOrderStatus.RETURN.getKey())); CustomerOrderStatus.RETURN.getKey()));
queryWrapperX.in("customer_dept_id", deptIds); queryWrapperX.in(CommonUtil.isNotEmpty(deptIds), "customer_dept_id", deptIds);
queryWrapperX.eq(CommonUtil.isNotEmpty(creator), "creator", creator);
return this.selectJoinOne(AppCustomerMonthOrderRespVO.class, queryWrapperX); return this.selectJoinOne(AppCustomerMonthOrderRespVO.class, queryWrapperX);
} }
...@@ -114,14 +115,15 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> { ...@@ -114,14 +115,15 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(), queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(),
CustomerOrderStatus.FINISH.getKey(), CustomerOrderStatus.FINISH.getKey(),
CustomerOrderStatus.RETURN.getKey())); CustomerOrderStatus.RETURN.getKey()));
queryWrapperX.in("customer_dept_id", reqVO.getDeptIds()); queryWrapperX.in(CommonUtil.isNotEmpty(reqVO.getDeptIds()), "customer_dept_id", reqVO.getDeptIds());
queryWrapperX.eq(CommonUtil.isNotEmpty(reqVO.getCreator()), "creator", reqVO.getCreator());
queryWrapperX.groupBy("DATE_FORMAT(create_time, '%Y-%m') "); queryWrapperX.groupBy("DATE_FORMAT(create_time, '%Y-%m') ");
queryWrapperX.orderByDesc("id"); queryWrapperX.orderByDesc("id");
return this.selectJoinPage(reqVO, AppCustomerMonthOrderRespVO.MonthItems.class, queryWrapperX); return this.selectJoinPage(reqVO, AppCustomerMonthOrderRespVO.MonthItems.class, queryWrapperX);
} }
default AppCustomerMonthOrderTotalRespVO reconciliationMonthTotal(String yearMonth, Set<Long> deptIds) { default AppCustomerMonthOrderTotalRespVO reconciliationMonthTotal(String yearMonth, Set<Long> deptIds, Long creator) {
String createMonth = yearMonth.trim(); String createMonth = yearMonth.trim();
String startOfMonth = createMonth + "-01 00:00:00"; String startOfMonth = createMonth + "-01 00:00:00";
String[] parts = createMonth.split("-"); String[] parts = createMonth.split("-");
...@@ -137,7 +139,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> { ...@@ -137,7 +139,8 @@ public interface CustomerOrderMapper extends BaseMapperX<CustomerOrderDO> {
queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(), queryWrapperX.in("order_status", CommonUtil.asList(CustomerOrderStatus.SIGN_RECEIPT.getKey(),
CustomerOrderStatus.FINISH.getKey(), CustomerOrderStatus.FINISH.getKey(),
CustomerOrderStatus.RETURN.getKey())); CustomerOrderStatus.RETURN.getKey()));
queryWrapperX.in("customer_dept_id", deptIds); queryWrapperX.in(CommonUtil.isNotEmpty(deptIds), "customer_dept_id", deptIds);
queryWrapperX.eq(CommonUtil.isNotEmpty(creator), "creator", creator);
queryWrapperX.orderByDesc("id"); queryWrapperX.orderByDesc("id");
return this.selectJoinOne(AppCustomerMonthOrderTotalRespVO.class, queryWrapperX); return this.selectJoinOne(AppCustomerMonthOrderTotalRespVO.class, queryWrapperX);
} }
......
...@@ -11,6 +11,7 @@ public interface ErrorCodeConstants { ...@@ -11,6 +11,7 @@ public interface ErrorCodeConstants {
// ========== 购物车 1_018-000-000 ========== // ========== 购物车 1_018-000-000 ==========
ErrorCode SHOPPING_CART_NOT_EXISTS = new ErrorCode(1_018_100_000, "购物车不存在"); ErrorCode SHOPPING_CART_NOT_EXISTS = new ErrorCode(1_018_100_000, "购物车不存在");
ErrorCode PRODUCT_DISABLE = new ErrorCode(1_018_100_001, "商品【{}】已下架"); ErrorCode PRODUCT_DISABLE = new ErrorCode(1_018_100_001, "商品【{}】已下架");
ErrorCode PRODUCT_NO_EXISTS = new ErrorCode(1_018_100_002, "商品不存在");
// ========== 客户总订单 1_019_100_0001 ========== // ========== 客户总订单 1_019_100_0001 ==========
ErrorCode CUSTOMER_ORDER_NOT_EXISTS = new ErrorCode(1_019_100_001, "客户总订单不存在"); ErrorCode CUSTOMER_ORDER_NOT_EXISTS = new ErrorCode(1_019_100_001, "客户总订单不存在");
......
...@@ -130,7 +130,7 @@ public interface CustomerOrderService { ...@@ -130,7 +130,7 @@ public interface CustomerOrderService {
* @param yearMonth * @param yearMonth
* @return * @return
*/ */
AppCustomerMonthOrderTotalRespVO monthTotal(String yearMonth, Set<Long> deptIds); AppCustomerMonthOrderTotalRespVO monthTotal(String yearMonth, Set<Long> deptIds, Long creator);
/** /**
* 对账确认 * 对账确认
......
...@@ -524,7 +524,14 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -524,7 +524,14 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
returnSaveReqVO.setWarehouseInfo(saleOrderDO.getWarehouseInfo()); returnSaveReqVO.setWarehouseInfo(saleOrderDO.getWarehouseInfo());
returnSaveReqVO.setAddressId(saleOrderDO.getAddressId()); returnSaveReqVO.setAddressId(saleOrderDO.getAddressId());
returnSaveReqVO.setAddressInfo(saleOrderDO.getAddressInfo()); returnSaveReqVO.setAddressInfo(saleOrderDO.getAddressInfo());
// 更新销售订单
ErpSaleOrderDO updateSaleOrder = new ErpSaleOrderDO();
updateSaleOrder.setId(saleOrderDO.getId());
updateSaleOrder.setPickUpStatus(SaleOrderPickUpStatus.RETURNS_PROCESS);
List<ErpSaleReturnSaveReqVO.Item> items = new ArrayList<>(reqVO.getOrderItems().size()); List<ErpSaleReturnSaveReqVO.Item> items = new ArrayList<>(reqVO.getOrderItems().size());
List<ErpSaleOrderItemDO> updateSaleOrderItems = new ArrayList<>(reqVO.getOrderItems().size());
for (AppCustomerReturnOrderReqVO.ReturnItems item : reqVO.getOrderItems()) { for (AppCustomerReturnOrderReqVO.ReturnItems item : reqVO.getOrderItems()) {
CustomerOrderItemDO customerOrderItemDO = orderItemMap.get(item.getCustomerOrderItemId()); CustomerOrderItemDO customerOrderItemDO = orderItemMap.get(item.getCustomerOrderItemId());
if (!Objects.equals(customerOrderItemDO.getProductId(), item.getProductId())) { if (!Objects.equals(customerOrderItemDO.getProductId(), item.getProductId())) {
...@@ -532,6 +539,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -532,6 +539,9 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
} }
ErpSaleReturnSaveReqVO.Item returnItem = new ErpSaleReturnSaveReqVO.Item(); ErpSaleReturnSaveReqVO.Item returnItem = new ErpSaleReturnSaveReqVO.Item();
ErpSaleOrderItemDO saleOrderItemDO = saleOrderService.queryItemByCustomerOrderItemId(customerOrderItemDO.getId()); ErpSaleOrderItemDO saleOrderItemDO = saleOrderService.queryItemByCustomerOrderItemId(customerOrderItemDO.getId());
ErpSaleOrderItemDO updateSaleOrderitem = new ErpSaleOrderItemDO();
updateSaleOrderitem.setId(saleOrderItemDO.getId());
updateSaleOrderitem.setPickUpStatus(SaleOrderPickUpStatus.RETURNS_PROCESS);
if (customerOrderItemDO.getSignedQuantity() - CommonUtil.getEls(customerOrderItemDO.getReturnsQuantity(), 0) if (customerOrderItemDO.getSignedQuantity() - CommonUtil.getEls(customerOrderItemDO.getReturnsQuantity(), 0)
< item.getReturnCount()) { < item.getReturnCount()) {
throw exception(CUSTOMER_ORDER_RETURN_COUNT_ERROR, customerOrderItemDO.getProductName()); throw exception(CUSTOMER_ORDER_RETURN_COUNT_ERROR, customerOrderItemDO.getProductName());
...@@ -547,9 +557,13 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -547,9 +557,13 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
returnItem.setRemark(item.getRemark()); returnItem.setRemark(item.getRemark());
returnItem.setSupplierId(customerOrderItemDO.getSupplierId()); returnItem.setSupplierId(customerOrderItemDO.getSupplierId());
items.add(returnItem); items.add(returnItem);
updateSaleOrderItems.add(updateSaleOrderitem);
} }
returnSaveReqVO.setItems(items); returnSaveReqVO.setItems(items);
saleReturnService.createSaleReturn(returnSaveReqVO); saleReturnService.createSaleReturn(returnSaveReqVO);
saleOrderService.update(updateSaleOrder, updateSaleOrderItems);
} finally { } finally {
RedisUtils.unLockRds(lock); RedisUtils.unLockRds(lock);
} }
...@@ -660,7 +674,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -660,7 +674,7 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
*/ */
@Override @Override
public AppCustomerMonthOrderRespVO reconciliationPageYear(AppCustomerYearOrderPageReqVO reqVO) { public AppCustomerMonthOrderRespVO reconciliationPageYear(AppCustomerYearOrderPageReqVO reqVO) {
AppCustomerMonthOrderRespVO respVO = customerOrderMapper.reconciliationPageYearTotal(reqVO.getYear(), reqVO.getDeptIds()); AppCustomerMonthOrderRespVO respVO = customerOrderMapper.reconciliationPageYearTotal(reqVO.getYear(), reqVO.getDeptIds(), reqVO.getCreator());
if (CommonUtil.isNotEmpty(respVO)) { if (CommonUtil.isNotEmpty(respVO)) {
respVO.setPageResult(customerOrderMapper.reconciliationPageYearPage(reqVO)); respVO.setPageResult(customerOrderMapper.reconciliationPageYearPage(reqVO));
} }
...@@ -674,8 +688,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO ...@@ -674,8 +688,8 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
* @return * @return
*/ */
@Override @Override
public AppCustomerMonthOrderTotalRespVO monthTotal(String yearMonth, Set<Long> deptIds) { public AppCustomerMonthOrderTotalRespVO monthTotal(String yearMonth, Set<Long> deptIds, Long loginUserId) {
return customerOrderMapper.reconciliationMonthTotal(yearMonth, deptIds); return customerOrderMapper.reconciliationMonthTotal(yearMonth, deptIds, loginUserId);
} }
@Override @Override
......
...@@ -77,14 +77,20 @@ public class ShoppingCartServiceImpl implements ShoppingCartService { ...@@ -77,14 +77,20 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void createBatch(ShoppingCartSaveBatchReqVO createReqVO) { public void createBatch(ShoppingCartSaveBatchReqVO createReqVO) {
List<ProductSpuDO> spuList = productSpuService.getSpuList(CommonUtil.listConvert(createReqVO.getItems(), ShoppingCartSaveReqVO::getProductId)); List<ProductSpuDO> spuList = productSpuService.getSpuList(CommonUtil.listConvert(createReqVO.getItems(), ShoppingCartSaveReqVO::getProductId));
if (CommonUtil.isEmpty(spuList)) {
throw exception(PRODUCT_NO_EXISTS);
}
List<ProductSpuDO> collect = spuList.stream().filter(item -> ProductSpuStatusEnum.isEnable(item.getStatus())).toList(); List<ProductSpuDO> collect = spuList.stream().filter(item -> ProductSpuStatusEnum.isEnable(item.getStatus())).toList();
if (CommonUtil.isEmpty(collect)) { if (CommonUtil.isEmpty(collect)) {
throw exception(PRODUCT_DISABLE, String.join(",", CommonUtil.listConvertSet(createReqVO.getItems(), ShoppingCartSaveReqVO::getProductName))); throw exception(PRODUCT_DISABLE, String.join(",", CommonUtil.listConvertSet(createReqVO.getItems(), ShoppingCartSaveReqVO::getProductName)));
} }
List<Long> productIds = CommonUtil.listConvert(collect, ProductSpuDO::getId);
for (ShoppingCartSaveReqVO item : createReqVO.getItems()) { for (ShoppingCartSaveReqVO item : createReqVO.getItems()) {
if (productIds.contains(item.getProductId())) {
this.createShoppingCart(item); this.createShoppingCart(item);
} }
} }
}
@Override @Override
public void updateShoppingCart(ShoppingCartSaveReqVO updateReqVO) { public void updateShoppingCart(ShoppingCartSaveReqVO updateReqVO) {
......
...@@ -79,9 +79,9 @@ public class AppProductSpuController { ...@@ -79,9 +79,9 @@ public class AppProductSpuController {
if (spu == null) { if (spu == null) {
throw exception(SPU_NOT_EXISTS); throw exception(SPU_NOT_EXISTS);
} }
if (!ProductSpuStatusEnum.isEnable(spu.getStatus())) { /*if (!ProductSpuStatusEnum.isEnable(spu.getStatus())) {
throw exception(SPU_NOT_ENABLE, spu.getName()); throw exception(SPU_NOT_ENABLE, spu.getName());
} }*/
// 增加浏览量 // 增加浏览量
productSpuService.updateBrowseCount(id, 1); productSpuService.updateBrowseCount(id, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment