| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.NumberFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | public R getCompanyData() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | NumberFormat formatter = new DecimalFormat("#,###"); |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy"); |
| | | String year = format.format(date); |
| | |
| | | if (companyTarget == null) { |
| | | return R.error(); |
| | | } |
| | | map.put("yearTarget", companyTarget.getTarget$());//全年交易目标 |
| | | map.put("yearTarget", formatter.format(Double.parseDouble(companyTarget.getTarget())));//全年交易目标 |
| | | |
| | | //获取全年交易成功金额 |
| | | Double successMoney = orderService.selectMoneyByYearAndStatus(year, 1); |
| | |
| | | Double failedMoney = orderService.selectMoneyByYearAndStatus(year, 2); |
| | | //全年交易率 |
| | | double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / (successMoney + progressMoney + failedMoney)) * 100; |
| | | map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//全年未交易成功金额 |
| | | |
| | | map.put("successMoney", formatter.format(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", formatter.format(progressMoney));//全年未交易成功金额 |
| | | map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//全年交易率 |
| | | return R.ok().add(map); |
| | | } |
| | |
| | | public R getPersonData() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | NumberFormat formatter = new DecimalFormat("#,###"); |
| | | Date date = new Date(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy"); |
| | | String year = format.format(date); |
| | | |
| | | User user = getUser(); |
| | | String yearTarget = "0.00";//获取个人全年目标数据 |
| | | String yearTarget = "0";//获取个人全年目标数据 |
| | | if (user.getTarget() != null) { |
| | | yearTarget = WordUtils.formatNumberForAccounting(Double.parseDouble(user.getTarget()));; |
| | | yearTarget = formatter.format(Double.parseDouble(user.getTarget())); |
| | | } |
| | | map.put("yearTarget", yearTarget);//全年交易目标 |
| | | |
| | |
| | | Double failedMoney = orderService.selectMoneyByUserAndYearAndStatus(user.getId(), year, 2); |
| | | //全年交易率 |
| | | double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / (successMoney + progressMoney + failedMoney)) * 100; |
| | | map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//全年未交易成功金额 |
| | | |
| | | map.put("successMoney", formatter.format(successMoney));//全年交易成功金额 |
| | | map.put("progressMoney", formatter.format(progressMoney));//全年未交易成功金额 |
| | | map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//全年交易率 |
| | | |
| | | //获取全年跟踪数量 |