|
|
@@ -52,6 +52,7 @@ import com.goafanti.evaluation.service.ValueEvaluationService;
|
|
|
@RequestMapping(value = "/api/user/evaluate")
|
|
|
public class EvaluationController extends BaseApiController {
|
|
|
|
|
|
+ private static final String GOVERNMENT_LOAN_ROR = "government_loan_ror";
|
|
|
private static final Logger logger = LoggerFactory.getLogger(EvaluationController.class);
|
|
|
private static final MathContext DEFAULT_PRECISION = new MathContext(4, RoundingMode.HALF_UP);
|
|
|
|
|
|
@@ -260,14 +261,18 @@ public class EvaluationController extends BaseApiController {
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/report/{id}", method = RequestMethod.GET)
|
|
|
- public Result report(@PathVariable String id) {
|
|
|
+ public Result report(@PathVariable String id, String noCache) {
|
|
|
Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
|
|
|
Result res = new Result();
|
|
|
ValueEvaluation ve = valueEvaluationService.getMyEvaluation(Long.valueOf(id));
|
|
|
if (ve == null || ve.getStep() < 7) {
|
|
|
res.error(buildError(ErrorConstants.EVALUATE_ID));
|
|
|
} else {
|
|
|
+ if (noCache != null) {
|
|
|
+ sysDictService.clear(GOVERNMENT_LOAN_ROR);
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("customer", TokenManager.getUserToken().getNickname());
|
|
|
calcValue(ve, map);
|
|
|
res.data(map);
|
|
|
}
|
|
|
@@ -311,9 +316,9 @@ public class EvaluationController extends BaseApiController {
|
|
|
Map<String, Integer> profitScores = getProfitScores(step2, step3);
|
|
|
Map<String, Integer> discountRates = getDiscountRates(step7);
|
|
|
|
|
|
- BigDecimal profitRate = calcProfitRate(profitScores, step1.getIndustry());
|
|
|
+ BigDecimal profitRate = calcProfitRate(profitScores, step1.getIndustry(), result);
|
|
|
|
|
|
- BigDecimal governmentLoanRoR = new BigDecimal(sysDictService.getValue("government_loan_ror"),
|
|
|
+ BigDecimal governmentLoanRoR = new BigDecimal(sysDictService.getValue(GOVERNMENT_LOAN_ROR),
|
|
|
MathContext.DECIMAL32);
|
|
|
BigDecimal taxRate = new BigDecimal(step6.getTaxRate());
|
|
|
|
|
|
@@ -378,7 +383,7 @@ public class EvaluationController extends BaseApiController {
|
|
|
return profitScores;
|
|
|
}
|
|
|
|
|
|
- private BigDecimal calcProfitRate(Map<String, Integer> profitScores, Integer industry) {
|
|
|
+ private BigDecimal calcProfitRate(Map<String, Integer> profitScores, Integer industry, Map<String, Object> map) {
|
|
|
BigDecimal legalFactor = new BigDecimal(0.2, DEFAULT_PRECISION);
|
|
|
BigDecimal techFactor = new BigDecimal(0.6, DEFAULT_PRECISION);
|
|
|
BigDecimal fundFactor = legalFactor;
|
|
|
@@ -415,7 +420,8 @@ public class EvaluationController extends BaseApiController {
|
|
|
minRate = new BigDecimal(pr.getMinRate());
|
|
|
maxRate = new BigDecimal(pr.getMaxRate());
|
|
|
}
|
|
|
-
|
|
|
+ map.put("minRate", minRate);
|
|
|
+ map.put("maxRate", maxRate);
|
|
|
profitRate = maxRate.subtract(minRate).multiply(profitRate.multiply(PERCENTAGE)).add(minRate)
|
|
|
.multiply(PERCENTAGE).setScale(4, RoundingMode.FLOOR);
|
|
|
|