前端保存老是报错HTTP ERROR 400 Bad Request。经过异常分析得出是前端传参导致的后端框架的验证拦截,包的错误。
{"timestamp":1545873831082,"status":400,"error":"Bad Request","exception":"org.springframework.validation.BindException","errors":[{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoney","typeMismatch.investmentEnsureMoney","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoney","investmentEnsureMoney"],"arguments":null,"defaultMessage":"investmentEnsureMoney","code":"investmentEnsureMoney"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoney'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoney","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"},{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoneyInterest","typeMismatch.investmentEnsureMoneyInterest","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoneyInterest","investmentEnsureMoneyInterest"],"arguments":null,"defaultMessage":"investmentEnsureMoneyInterest","code":"investmentEnsureMoneyInterest"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoneyInterest'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoneyInterest","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"}],"message":"Validation failed for object='capitalInvestmentParam'. Error count: 2","path":"/rayProjectCapitalInvestment/insertStockPowerInvestment"}
Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoneyInterest'; nested exception is java.lang.NumberFormatException
看一下前端传入的参数如下图:
image.png
image.png