zss
2026-04-23 8a426c83006afd3f91fd763f9fb215ffa930c66d
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -17,8 +17,10 @@
import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
import com.ruoyi.sales.service.ShippingInfoService;
import com.ruoyi.sales.vo.ShippingInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -46,7 +48,7 @@
    @GetMapping("/listPage")
    @ApiOperation("发货信息列表")
    public AjaxResult listPage(Page page, ShippingInfo req) {
        IPage<ShippingInfo> listPage = shippingInfoService.listPage(page,req);
        IPage<ShippingInfoVo> listPage = shippingInfoService.listPage(page,req);
        return AjaxResult.success(listPage);
    }
@@ -54,15 +56,16 @@
    @ApiOperation("添加发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody ShippingInfo req) {
        LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ShippingInfo::getSalesLedgerId, req.getSalesLedgerId());
        wrapper.eq(ShippingInfo::getSalesLedgerProductId, req.getSalesLedgerProductId());
        List<ShippingInfo> list = shippingInfoService.list(wrapper);
        if(!CollectionUtils.isEmpty(list)){
            return AjaxResult.error("发货信息已存在");
        }
        boolean save = shippingInfoService.save(req);
        if(save){
            LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(ShippingInfo::getSalesLedgerId, req.getSalesLedgerId());
            wrapper.eq(ShippingInfo::getSalesLedgerProductId, req.getSalesLedgerProductId());
            ShippingInfo shippingInfo = shippingInfoService.getOne(wrapper);
            if(shippingInfo == null){
                return AjaxResult.error("发货信息不存在");
            }
            ShipmentApproval shipmentApproval = new ShipmentApproval();
            shipmentApproval.setSalesLedgerId(req.getSalesLedgerId());
            shipmentApproval.setSalesLedgerProductId(req.getSalesLedgerProductId());