4 小时以前 1d71388c969305b6c6fc73caa0b0a41cd7993b67
fix(purchase): 修复采购台账模板中产品类型设置问题

- 在PurchaseLedgerController中添加事务注解支持
- 在PurchaseLedgerController中导入Arrays工具类
- 为销售台账产品模板设置正确的类型值为2
已修改2个文件
7 ■■■■■ 文件已修改
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerTemplateController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerController.java
@@ -25,6 +25,7 @@
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -35,6 +36,7 @@
import java.io.OutputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
src/main/java/com/ruoyi/purchase/controller/PurchaseLedgerTemplateController.java
@@ -16,6 +16,7 @@
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@@ -43,6 +44,7 @@
    @PostMapping("/add")
    @Log(title = "添加采购台账模板", businessType = BusinessType.INSERT)
    @ApiOperation(value = "添加采购台账模板")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) {
        // 采购模板
        if(StringUtils.isNotEmpty(purchaseLedgerDto.getTemplateName())){
@@ -73,6 +75,7 @@
    @DeleteMapping("/delete")
    @Log(title = "采购台账模板", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除采购台账模板")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult delete(@RequestBody List<Long> id) {
        if(CollectionUtils.isEmpty(id)) return AjaxResult.error("请选择要删除的采购台账模板");
        int result = purchaseLedgerTemplateMapper.deleteBatchIds(id);
@@ -84,6 +87,7 @@
    @PostMapping("/update")
    @Log(title = "修改采购台账模板", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改采购台账模板")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) {
        // 模板名称不能重复,有重复就不需要新增了
        PurchaseLedgerTemplate purchaseLedgerTemplate = purchaseLedgerTemplateMapper
@@ -102,6 +106,7 @@
                SalesLedgerProductTemplate salesLedgerProductTemplate = new SalesLedgerProductTemplate();
                BeanUtils.copyProperties(product, salesLedgerProductTemplate);
                salesLedgerProductTemplate.setSalesLedgerId(purchaseLedgerTemplate.getId());
                salesLedgerProductTemplate.setType(2);
                salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate);
            });
        }