yaowanxin
5 天以前 0c022a90326d9e7afbfd816c789f7bd3ac848e06
修改添加发货信息接口
已修改1个文件
12 ■■■■■ 文件已修改
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -19,6 +19,7 @@
import com.ruoyi.sales.service.ShippingInfoService;
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.*;
@@ -54,15 +55,16 @@
    @ApiOperation("添加发货信息")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody ShippingInfo req) {
        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("发货信息不存在");
        List<ShippingInfo> list = shippingInfoService.list(wrapper);
        if(!CollectionUtils.isEmpty(list)){
            return AjaxResult.error("发货信息已存在");
            }
        boolean save = shippingInfoService.save(req);
        if(save){
            ShippingInfo shippingInfo = shippingInfoService.getOne(wrapper);
            ShipmentApproval shipmentApproval = new ShipmentApproval();
            shipmentApproval.setSalesLedgerId(req.getSalesLedgerId());
            shipmentApproval.setSalesLedgerProductId(req.getSalesLedgerProductId());