albertshaw преди 8 години
родител
ревизия
9bfef73b7c

+ 50 - 0
src/main/java/com/goafanti/evaluation/bo/ForecastIncome.java

@@ -0,0 +1,50 @@
+package com.goafanti.evaluation.bo;
+
+public class ForecastIncome {
+	private Long	marketScale	= 0l;
+	private Integer	marketRate	= 0;
+	private Long	unitPrice	= 0l;
+	private Long	saleCount	= 0l;
+	private Long	income		= 0l;
+
+	public Long getMarketScale() {
+		return marketScale;
+	}
+
+	public void setMarketScale(Long marketScale) {
+		this.marketScale = marketScale;
+	}
+
+	public Integer getMarketRate() {
+		return marketRate;
+	}
+
+	public void setMarketRate(Integer marketRate) {
+		this.marketRate = marketRate;
+	}
+
+	public Long getUnitPrice() {
+		return unitPrice;
+	}
+
+	public void setUnitPrice(Long unitPrice) {
+		this.unitPrice = unitPrice;
+	}
+
+	public Long getSaleCount() {
+		return saleCount;
+	}
+
+	public void setSaleCount(Long saleCount) {
+		this.saleCount = saleCount;
+	}
+
+	public Long getIncome() {
+		return income;
+	}
+
+	public void setIncome(Long income) {
+		this.income = income;
+	}
+
+}

+ 25 - 0
src/main/java/com/goafanti/evaluation/bo/Step5.java

@@ -0,0 +1,25 @@
+package com.goafanti.evaluation.bo;
+
+import java.util.List;
+
+public class Step5 {
+	private Integer					type;
+	private List<ForecastIncome>	forecastIncomes;
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public List<ForecastIncome> getForecastIncomes() {
+		return forecastIncomes;
+	}
+
+	public void setForecastIncomes(List<ForecastIncome> forecastIncomes) {
+		this.forecastIncomes = forecastIncomes;
+	}
+
+}

+ 17 - 0
src/main/java/com/goafanti/evaluation/bo/Step6.java

@@ -0,0 +1,17 @@
+package com.goafanti.evaluation.bo;
+
+import javax.validation.constraints.NotNull;
+
+public class Step6 {
+	@NotNull
+	private Integer	taxRate;
+
+	public Integer getTaxRate() {
+		return taxRate;
+	}
+
+	public void setTaxRate(Integer taxRate) {
+		this.taxRate = taxRate;
+	}
+	
+}

+ 67 - 0
src/main/java/com/goafanti/evaluation/bo/Step7.java

@@ -0,0 +1,67 @@
+package com.goafanti.evaluation.bo;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.NotNull;
+
+public class Step7 {
+	@NotNull
+	@Max(value = 7)
+	private Integer	political;
+
+	@NotNull
+	@Max(value = 7)
+	private Integer	technical;
+
+	@NotNull
+	@Max(value = 7)
+	private Integer	market;
+
+	@NotNull
+	@Max(value = 7)
+	private Integer	capital;
+
+	@NotNull
+	@Max(value = 7)
+	private Integer	management;
+
+	public Integer getPolitical() {
+		return political;
+	}
+
+	public void setPolitical(Integer political) {
+		this.political = political;
+	}
+
+	public Integer getTechnical() {
+		return technical;
+	}
+
+	public void setTechnical(Integer technical) {
+		this.technical = technical;
+	}
+
+	public Integer getMarket() {
+		return market;
+	}
+
+	public void setMarket(Integer market) {
+		this.market = market;
+	}
+
+	public Integer getCapital() {
+		return capital;
+	}
+
+	public void setCapital(Integer capital) {
+		this.capital = capital;
+	}
+
+	public Integer getManagement() {
+		return management;
+	}
+
+	public void setManagement(Integer management) {
+		this.management = management;
+	}
+	
+}

+ 49 - 0
src/main/java/com/goafanti/evaluation/controller/EvaluationController.java

@@ -29,10 +29,14 @@ import com.goafanti.common.model.ValueEvaluation;
 import com.goafanti.common.service.IndustryCategoryService;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.evaluation.bo.ForecastIncome;
 import com.goafanti.evaluation.bo.Step1;
 import com.goafanti.evaluation.bo.Step2;
 import com.goafanti.evaluation.bo.Step3;
 import com.goafanti.evaluation.bo.Step4;
+import com.goafanti.evaluation.bo.Step5;
+import com.goafanti.evaluation.bo.Step6;
+import com.goafanti.evaluation.bo.Step7;
 import com.goafanti.evaluation.bo.YearIncome;
 import com.goafanti.evaluation.service.ValueEvaluationService;
 
@@ -147,6 +151,29 @@ public class EvaluationController extends BaseApiController {
 		return res;
 	}
 
+	@RequestMapping(value = "/step5", method = RequestMethod.POST)
+	public Result step5(String id, String type, String forecastIncomes) {
+		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
+		Result res = new Result();
+		Step5 step = new Step5();
+		try {
+			step.setType(Integer.valueOf(type));
+			List<ForecastIncome> ja = JSON.parseArray(forecastIncomes, ForecastIncome.class);
+			if (ja.size() != 3) {
+				res.error(buildError(ErrorConstants.EVALUATE_PARAM));
+			} else {
+				step.setForecastIncomes(ja);
+			}
+
+		} catch (Exception e) {
+			res.error(buildError(ErrorConstants.EVALUATE_PARAM));
+		}
+		if (res.getError().isEmpty()) {
+			updateSteps(step, 5, "4", res, id);
+		}
+		return res;
+	}
+
 	@RequestMapping(value = "/step5/{id}", method = RequestMethod.GET)
 	public Result step5Info(@PathVariable String id) {
 		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
@@ -164,6 +191,28 @@ public class EvaluationController extends BaseApiController {
 		}
 		return res;
 	}
+	
+	@RequestMapping(value = "/step6", method = RequestMethod.POST)
+	public Result step6(String id, @Valid Step6 data, BindingResult bindingResult) {
+		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
+		Result res = new Result();
+		if (handleBindingError(res, bindingResult)) {
+			return res;
+		}
+		updateSteps(data, 6, "5", res, id);
+		return res;
+	}
+	
+	@RequestMapping(value = "/step7", method = RequestMethod.POST)
+	public Result step7(String id, @Valid Step7 data, BindingResult bindingResult) {
+		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
+		Result res = new Result();
+		if (handleBindingError(res, bindingResult)) {
+			return res;
+		}
+		updateSteps(data, 7, "6", res, id);
+		return res;
+	}
 
 	private void updateSteps(Object step, Integer nextStep, String key, Result res, String id) {
 		ValueEvaluation ve = valueEvaluationService.getEvaluation(Long.valueOf(id));

+ 4 - 1
src/main/java/com/goafanti/evaluation/service/ValueEvaluationService.java

@@ -34,7 +34,10 @@ public class ValueEvaluationService extends BaseMybatisDao<ValueEvaluationMapper
 	}
 
 	public ValueEvaluation getEvaluation(Long id) {
-		return valueEvaluationMapper.selectByPrimaryKey(id);
+		Map<String, Object> params = new HashMap<>();
+		params.put("uid", TokenManager.getUserId());
+		params.put("id", id);
+		return valueEvaluationMapper.selectByPrimaryKeyAndUser(params);
 	}
 
 	public String getMyEvaluationSteps(Long id) {