| | |
| | | IPage<SalesLedgerProductionAccountingDto> list = salesLedgerProductionAccountingMapper.listPage(page, salesLedgerProductionAccountingDto); |
| | | list.getRecords().forEach(item -> { |
| | | String[] split = item.getSpecificationModel().split("\\*"); |
| | | if(split.length == 2){ |
| | | if(split.length == 2 && isNumeric(split[1])){ |
| | | // 计算工资 = 工时定额 * 数量 * 规格 |
| | | item.setWages(item.getWages().multiply(new BigDecimal(split[1]))); |
| | | } |
| | | }); |
| | | 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; |
| | | } |
| | | } |