maven
6 天以前 83b345680004d1f9203a847ecb39bbebc6a51478
src/main/java/com/ruoyi/production/service/impl/SalesLedgerProductionAccountingServiceImpl.java
@@ -11,6 +11,8 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
 * @author :yys
 * @date : 2025/7/21 14:41
@@ -25,6 +27,23 @@
    @Override
    public IPage<SalesLedgerProductionAccountingDto> listPage(Page page, SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto) {
        IPage<SalesLedgerProductionAccountingDto> list = salesLedgerProductionAccountingMapper.listPage(page, salesLedgerProductionAccountingDto);
        list.getRecords().forEach(item -> {
            // 计算工资 = 生产数量 * 产品含税单价 * 提成率,保留三位小数不用四舍五入
            item.setWages(item.getWages().multiply(item.getTaxInclusiveUnitPrice()).setScale(3, BigDecimal.ROUND_HALF_UP));
        });
        return list;
    }
    public static boolean isNumeric(String str) {
        if (str == null || str.isEmpty()) {
            return false;
        }
        // 遍历字符串的每个字符,检查是否为数字
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
}