Commit 2f7230fd by 杨浩

后台调整

parent e7d23e39
package cn.iocoder.foodnexus.module.erp.controller.admin.purchase;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.collection.MapUtils;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi;
import cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnPageReqVO;
import cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.returns.ErpPurchaseReturnRespVO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseReturnDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseReturnItemDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseReturnService;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.foodnexus.module.erp.service.stock.ErpStockService;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth;
import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi;
import cn.iocoder.foodnexus.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertMultiMap;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "供应商 - ERP 采购退货")
@RestController
@RequestMapping("/supplier/purchase-return")
@Validated
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public class SupplierPurchaseReturnController {
@Resource
private ErpPurchaseReturnService purchaseReturnService;
@Resource
private ErpStockService stockService;
@Resource
private ErpSupplierService supplierService;
@Resource
private AdminUserApi adminUserApi;
@Autowired
private CustomerOrderApi customerOrderApi;
@Autowired
private ErpCustomerApi customerApi;
@Autowired
private ErpSupplierApi supplierApi;
@DeleteMapping("/delete")
@Operation(summary = "删除采购退货")
@Parameter(name = "ids", description = "编号数组", required = true)
@PreAuthorize("@ss.hasPermission('erp:purchase-return:delete')")
public CommonResult<Boolean> deletePurchaseReturn(@RequestParam("ids") List<Long> ids) {
purchaseReturnService.deletePurchaseReturn(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得采购退货")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
public CommonResult<ErpPurchaseReturnRespVO> getPurchaseReturn(@RequestParam("id") Long id) {
ErpPurchaseReturnDO purchaseReturn = purchaseReturnService.getPurchaseReturn(id);
if (purchaseReturn == null) {
return success(null);
}
List<ErpPurchaseReturnItemDO> purchaseReturnItemList = purchaseReturnService.getPurchaseReturnItemListByReturnId(id);
return success(BeanUtils.toBean(purchaseReturn, ErpPurchaseReturnRespVO.class, purchaseReturnVO ->{
String supplierName = Optional.ofNullable(supplierService.getSupplier(purchaseReturnVO.getSupplierId())).map(ErpSupplierDO::getName).orElse("");
String orderCode = Optional.ofNullable(customerOrderApi.queryById(purchaseReturnVO.getCustomerOrderId())).map(CustomerOrderDTO::getCode).orElse("");
purchaseReturnVO.setSupplierName(supplierName);
purchaseReturnVO.setCustomerOrderCode(orderCode);
purchaseReturnVO.setItems(BeanUtils.toBean(purchaseReturnItemList, ErpPurchaseReturnRespVO.Item.class, item -> {
ErpStockDO stock = stockService.getStock(item.getProductId(), item.getWarehouseId());
item.setStockCount(stock != null ? stock.getCount() : BigDecimal.ZERO);
}));
}));
}
@GetMapping("/page")
@Operation(summary = "获得采购退货分页")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:query')")
public CommonResult<PageResult<ErpPurchaseReturnRespVO>> getPurchaseReturnPage(@Valid ErpPurchaseReturnPageReqVO pageReqVO) {
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
PageResult<ErpPurchaseReturnDO> pageResult = purchaseReturnService.getPurchaseReturnPage(pageReqVO);
return success(buildPurchaseReturnVOPageResult(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出采购退货 Excel")
@PreAuthorize("@ss.hasPermission('erp:purchase-return:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPurchaseReturnExcel(@Valid ErpPurchaseReturnPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
pageReqVO.setSupplierId(supplierApi.querySupplierIdByUserId(SecurityFrameworkUtils.getLoginUserId()));
List<ErpPurchaseReturnRespVO> list = buildPurchaseReturnVOPageResult(purchaseReturnService.getPurchaseReturnPage(pageReqVO)).getList();
// 导出 Excel
ExcelUtils.write(response, "采购退货.xls", "数据", ErpPurchaseReturnRespVO.class, list);
}
private PageResult<ErpPurchaseReturnRespVO> buildPurchaseReturnVOPageResult(PageResult<ErpPurchaseReturnDO> pageResult) {
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 1.1 退货项
List<ErpPurchaseReturnItemDO> purchaseReturnItemList = purchaseReturnService.getPurchaseReturnItemListByReturnIds(
convertSet(pageResult.getList(), ErpPurchaseReturnDO::getId));
Map<Long, List<ErpPurchaseReturnItemDO>> purchaseReturnItemMap = convertMultiMap(purchaseReturnItemList, ErpPurchaseReturnItemDO::getReturnId);
// 1.3 供应商信息
Map<Long, ErpSupplierDO> supplierMap = supplierService.getSupplierMap(
convertSet(pageResult.getList(), ErpPurchaseReturnDO::getSupplierId));
// 1.4 管理员信息
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSet(pageResult.getList(), purchaseReturn -> Long.parseLong(purchaseReturn.getCreator())));
Map<Long, String> customerOrderCodeMap = customerOrderApi.getCodeMap(CommonUtil.listConvert(pageResult.getList(), ErpPurchaseReturnDO::getCustomerOrderId));
Map<Long, String> customerNameMap = customerApi.queryNameMapByIds(CommonUtil.listConvertSet(pageResult.getList(), ErpPurchaseReturnDO::getCustomerId));
// 2. 开始拼接
return BeanUtils.toBean(pageResult, ErpPurchaseReturnRespVO.class, purchaseReturn -> {
purchaseReturn.setItems(BeanUtils.toBean(purchaseReturnItemMap.get(purchaseReturn.getId()), ErpPurchaseReturnRespVO.Item.class));
purchaseReturn.setProductNames(CollUtil.join(purchaseReturn.getItems(), ",", item ->
Optional.ofNullable(item.getProductInfo()).map(ProductInfo::getName).orElse("")));
MapUtils.findAndThen(supplierMap, purchaseReturn.getSupplierId(), supplier -> purchaseReturn.setSupplierName(supplier.getName()));
MapUtils.findAndThen(userMap, Long.parseLong(purchaseReturn.getCreator()), user -> purchaseReturn.setCreatorName(user.getNickname()));
MapUtils.findAndThen(customerOrderCodeMap, purchaseReturn.getCustomerOrderId(), purchaseReturn::setCustomerOrderCode);
MapUtils.findAndThen(customerNameMap, purchaseReturn.getCustomerId(), purchaseReturn::setCustomerName);
});
}
}
\ No newline at end of file
...@@ -94,4 +94,10 @@ public class ErpPurchaseOrderPageReqVO extends PageParam { ...@@ -94,4 +94,10 @@ public class ErpPurchaseOrderPageReqVO extends PageParam {
@Schema(description = "配送模式") @Schema(description = "配送模式")
private DeliveryMode deliveryMode; private DeliveryMode deliveryMode;
@Schema(description = "客户订单id")
private Long customerOrderId;
@Schema(description = "客户名称")
private String customerName;
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ import cn.iocoder.foodnexus.framework.common.enums.CommonStatusEnum; ...@@ -5,6 +5,8 @@ import cn.iocoder.foodnexus.framework.common.enums.CommonStatusEnum;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult; import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam; import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult; import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.collection.MapUtils;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils; import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils; import cn.iocoder.foodnexus.framework.excel.core.util.ExcelUtils;
import cn.iocoder.foodnexus.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.foodnexus.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
...@@ -25,6 +27,9 @@ import org.springframework.web.bind.annotation.*; ...@@ -25,6 +27,9 @@ import org.springframework.web.bind.annotation.*;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.foodnexus.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success; import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
...@@ -81,7 +86,13 @@ public class ErpWarehouseController { ...@@ -81,7 +86,13 @@ public class ErpWarehouseController {
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')") @PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<ErpWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) { public CommonResult<ErpWarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
ErpWarehouseDO warehouse = warehouseService.getWarehouse(id); ErpWarehouseDO warehouse = warehouseService.getWarehouse(id);
return success(BeanUtils.toBean(warehouse, ErpWarehouseRespVO.class)); return success(BeanUtils.toBean(warehouse, ErpWarehouseRespVO.class, item -> {
if (!Objects.equals(item.getParentId(), ErpWarehouseDO.PARENT_ID_ROOT)) {
item.setParentName("");
} else {
item.setParentName(Optional.ofNullable(warehouseService.getWarehouse(item.getParentId())).map(ErpWarehouseDO::getName).orElse(""));
}
}));
} }
@GetMapping("/list-by-ids") @GetMapping("/list-by-ids")
...@@ -89,7 +100,11 @@ public class ErpWarehouseController { ...@@ -89,7 +100,11 @@ public class ErpWarehouseController {
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')") @PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<List<ErpWarehouseRespVO>> getWarehouse(@RequestParam("ids") List<Long> ids) { public CommonResult<List<ErpWarehouseRespVO>> getWarehouse(@RequestParam("ids") List<Long> ids) {
return success(BeanUtils.toBean(warehouseService.getWarehouseList(ids), ErpWarehouseRespVO.class)); List<ErpWarehouseDO> warehouseList = warehouseService.getWarehouseList(ids);
Map<Long, String> nameMap = warehouseService.queryNameByIds(CommonUtil.listConvertSet(warehouseList, ErpWarehouseDO::getId));
return success(BeanUtils.toBean(warehouseList, ErpWarehouseRespVO.class, item -> {
MapUtils.findAndThen(nameMap, item.getParentId(), item::setParentName);
}));
} }
@GetMapping("/page") @GetMapping("/page")
...@@ -97,7 +112,10 @@ public class ErpWarehouseController { ...@@ -97,7 +112,10 @@ public class ErpWarehouseController {
@PreAuthorize("@ss.hasPermission('erp:warehouse:query')") @PreAuthorize("@ss.hasPermission('erp:warehouse:query')")
public CommonResult<PageResult<ErpWarehouseRespVO>> getWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) { public CommonResult<PageResult<ErpWarehouseRespVO>> getWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) {
PageResult<ErpWarehouseDO> pageResult = warehouseService.getWarehousePage(pageReqVO); PageResult<ErpWarehouseDO> pageResult = warehouseService.getWarehousePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class)); Map<Long, String> nameMap = warehouseService.queryNameByIds(CommonUtil.listConvertSet(pageResult.getList(), ErpWarehouseDO::getId));
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class, item -> {
MapUtils.findAndThen(nameMap, item.getParentId(), item::setParentName);
}));
} }
@GetMapping("/simple-list") @GetMapping("/simple-list")
......
...@@ -76,5 +76,11 @@ public class ErpWarehouseRespVO { ...@@ -76,5 +76,11 @@ public class ErpWarehouseRespVO {
@Schema(description = "库区所属仓库id, level=warehouse为0", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") @Schema(description = "库区所属仓库id, level=warehouse为0", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
private Long parentId; private Long parentId;
@Schema(description = "库区所属仓库id")
private String parentName;
@Schema(description = "面积")
private String area;
} }
...@@ -58,4 +58,7 @@ public class ErpWarehouseSaveReqVO { ...@@ -58,4 +58,7 @@ public class ErpWarehouseSaveReqVO {
@NotNull(message = "库区所属仓库id不能为空") @NotNull(message = "库区所属仓库id不能为空")
private Long parentId; private Long parentId;
@Schema(description = "面积")
private String area;
} }
\ No newline at end of file
...@@ -84,5 +84,9 @@ public class ErpWarehouseDO extends BaseDO { ...@@ -84,5 +84,9 @@ public class ErpWarehouseDO extends BaseDO {
* 库区所属仓库id * 库区所属仓库id
*/ */
private Long parentId; private Long parentId;
/**
* 面积
*/
private String area;
} }
\ No newline at end of file
...@@ -54,6 +54,7 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO> ...@@ -54,6 +54,7 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
.likeIfPresent(ErpPurchaseOrderDO::getRemark, reqVO.getRemark()) .likeIfPresent(ErpPurchaseOrderDO::getRemark, reqVO.getRemark())
.eqIfPresent(ErpPurchaseOrderDO::getCreator, reqVO.getCreator()) .eqIfPresent(ErpPurchaseOrderDO::getCreator, reqVO.getCreator())
.inIfPresent(ErpPurchaseOrderDO::getDeliveryStatus, reqVO.getDeliveryStatus()) .inIfPresent(ErpPurchaseOrderDO::getDeliveryStatus, reqVO.getDeliveryStatus())
.eqIfPresent(ErpPurchaseOrderDO::getCustomerOrderId, reqVO.getCustomerOrderId())
.orderByDesc(ErpPurchaseOrderDO::getId); .orderByDesc(ErpPurchaseOrderDO::getId);
// 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 in_count 错误 // 入库状态。为什么需要 t. 的原因,是因为联表查询时,需要指定表名,不然会报 in_count 错误
if (Objects.equals(reqVO.getInStatus(), ErpPurchaseOrderPageReqVO.IN_STATUS_NONE)) { if (Objects.equals(reqVO.getInStatus(), ErpPurchaseOrderPageReqVO.IN_STATUS_NONE)) {
...@@ -103,6 +104,12 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO> ...@@ -103,6 +104,12 @@ public interface ErpPurchaseOrderMapper extends BaseMapperX<ErpPurchaseOrderDO>
query.ge(ErpPurchaseOrderDO::getCreateTime, startOfMonth) query.ge(ErpPurchaseOrderDO::getCreateTime, startOfMonth)
.lt(ErpPurchaseOrderDO::getCreateTime, endOfMonth); .lt(ErpPurchaseOrderDO::getCreateTime, endOfMonth);
} }
if (CommonUtil.isNotBlank(reqVO.getCustomerName())) {
query.leftJoin("order_customer_order oco on oco.id = t.customer_order_id");
query.leftJoin("erp_customer ec on ec.id = oco.customer_id");
query.like("ec.`name`", reqVO.getCustomerName());
query.groupBy(ErpPurchaseOrderDO::getId);
}
return query; return query;
} }
......
...@@ -9,6 +9,7 @@ import jakarta.validation.Valid; ...@@ -9,6 +9,7 @@ import jakarta.validation.Valid;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertMap;
...@@ -99,4 +100,5 @@ public interface ErpWarehouseService { ...@@ -99,4 +100,5 @@ public interface ErpWarehouseService {
*/ */
PageResult<ErpWarehouseDO> getWarehousePage(ErpWarehousePageReqVO pageReqVO); PageResult<ErpWarehouseDO> getWarehousePage(ErpWarehousePageReqVO pageReqVO);
Map<Long, String> queryNameByIds(Collection<Long> longs);
} }
\ No newline at end of file
...@@ -17,10 +17,8 @@ import org.springframework.stereotype.Service; ...@@ -17,10 +17,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.Collection; import java.util.*;
import java.util.Collections; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertMap;
...@@ -127,6 +125,23 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService, ErpWarehous ...@@ -127,6 +125,23 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService, ErpWarehous
} }
@Override @Override
public Map<Long, String> queryNameByIds(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return new HashMap<>();
}
Map<Long, String> rootMap = new HashMap<>();
rootMap.put(ErpWarehouseDO.PARENT_ID_ROOT, "");
List<Long> collect = ids.stream().filter(id -> !Objects.equals(id, ErpWarehouseDO.PARENT_ID_ROOT)).toList();
if (CommonUtil.isEmpty(collect)) {
return rootMap;
}
List<ErpWarehouseDO> erpWarehouseDOS = warehouseMapper.selectByIds(collect);
Map<Long, String> result = CommonUtil.listConvertMap(erpWarehouseDOS, ErpWarehouseDO::getId, ErpWarehouseDO::getName);
result.putAll(rootMap);
return result;
}
@Override
public boolean existsById(Long warehouseId) { public boolean existsById(Long warehouseId) {
return warehouseMapper.exists(Wrappers.<ErpWarehouseDO>lambdaQuery() return warehouseMapper.exists(Wrappers.<ErpWarehouseDO>lambdaQuery()
.eq(ErpWarehouseDO::getId, warehouseId) .eq(ErpWarehouseDO::getId, warehouseId)
......
...@@ -34,7 +34,10 @@ public class AppInquireCustomerPushPageReqVO extends PageParam { ...@@ -34,7 +34,10 @@ public class AppInquireCustomerPushPageReqVO extends PageParam {
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "询价年月") @Schema(description = "询价年月 yyyy-MM")
private String inquiryYearMonth; private String inquiryYearMonth;
@Schema(description = "询价年份 yyyy")
private String inquireYear;
} }
\ No newline at end of file
...@@ -52,6 +52,7 @@ public interface InquireCustomerPushMapper extends BaseMapperX<InquireCustomerPu ...@@ -52,6 +52,7 @@ public interface InquireCustomerPushMapper extends BaseMapperX<InquireCustomerPu
wrapperX.between(InquireCustomerPushDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1]); wrapperX.between(InquireCustomerPushDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1]);
} }
wrapperX.eqIfExists(InquirePriceDO::getInquiryYearMonth, reqVO.getInquiryYearMonth()); wrapperX.eqIfExists(InquirePriceDO::getInquiryYearMonth, reqVO.getInquiryYearMonth());
wrapperX.likeRightIfExists(InquirePriceDO::getInquiryYearMonth, reqVO.getInquireYear());
wrapperX.groupBy(InquireCustomerPushDO::getId); wrapperX.groupBy(InquireCustomerPushDO::getId);
wrapperX.orderByDesc(InquireCustomerPushDO::getId); wrapperX.orderByDesc(InquireCustomerPushDO::getId);
return selectJoinPage(reqVO, AppInquireCustomerPushRespVO.class, wrapperX); return selectJoinPage(reqVO, AppInquireCustomerPushRespVO.class, wrapperX);
......
...@@ -151,9 +151,12 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS ...@@ -151,9 +151,12 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void bindCustomer(DeliveryStaffBindCustomerReqVO updateReqVO) { public void bindCustomer(DeliveryStaffBindCustomerReqVO updateReqVO) {
validateDeliveryStaffExists(updateReqVO.getStaffId()); validateDeliveryStaffExists(updateReqVO.getStaffId());
deliveryStaffCustomerMapper.delete(DeliveryStaffCustomerDO::getDeliveryStaffId, updateReqVO.getStaffId()); deliveryStaffCustomerMapper.delete(Wrappers.<DeliveryStaffCustomerDO>lambdaQuery()
.eq(DeliveryStaffCustomerDO::getDeliveryStaffId, updateReqVO.getStaffId())
.eq(DeliveryStaffCustomerDO::getIsDept, Boolean.FALSE));
if (CommonUtil.isNotEmpty(updateReqVO.getCustomerIdList())) { if (CommonUtil.isNotEmpty(updateReqVO.getCustomerIdList())) {
List<DeliveryStaffCustomerDO> deliveryStaffCustomerDOS = CommonUtil.listConvert(updateReqVO.getCustomerIdList(), customer -> { List<DeliveryStaffCustomerDO> deliveryStaffCustomerDOS = CommonUtil.listConvert(updateReqVO.getCustomerIdList(), customer -> {
DeliveryStaffCustomerDO deliveryStaffCustomerDO = new DeliveryStaffCustomerDO(); DeliveryStaffCustomerDO deliveryStaffCustomerDO = new DeliveryStaffCustomerDO();
...@@ -181,9 +184,12 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS ...@@ -181,9 +184,12 @@ public class DeliveryStaffServiceImpl implements DeliveryStaffService, DeliveryS
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void bindDept(DeliveryStaffBindDeptReqVO updateReqVO) { public void bindDept(DeliveryStaffBindDeptReqVO updateReqVO) {
validateDeliveryStaffExists(updateReqVO.getStaffId()); validateDeliveryStaffExists(updateReqVO.getStaffId());
deliveryStaffCustomerMapper.delete(DeliveryStaffCustomerDO::getDeliveryStaffId, updateReqVO.getStaffId()); deliveryStaffCustomerMapper.delete(Wrappers.<DeliveryStaffCustomerDO>lambdaQuery()
.eq(DeliveryStaffCustomerDO::getDeliveryStaffId, updateReqVO.getStaffId())
.eq(DeliveryStaffCustomerDO::getIsDept, Boolean.TRUE));
if (CommonUtil.isNotEmpty(updateReqVO.getDeptIdList())) { if (CommonUtil.isNotEmpty(updateReqVO.getDeptIdList())) {
List<DeliveryStaffCustomerDO> deliveryStaffCustomerDOS = CommonUtil.listConvert(updateReqVO.getDeptIdList(), deptId -> { List<DeliveryStaffCustomerDO> deliveryStaffCustomerDOS = CommonUtil.listConvert(updateReqVO.getDeptIdList(), deptId -> {
DeliveryStaffCustomerDO deliveryStaffCustomerDO = new DeliveryStaffCustomerDO(); DeliveryStaffCustomerDO deliveryStaffCustomerDO = new DeliveryStaffCustomerDO();
......
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