anderx лет назад: 5
Родитель
Сommit
c98ba17914

+ 0 - 51
src/main/java/com/goafanti/admin/controller/AdminTriggerController.java

@@ -1,51 +0,0 @@
-package com.goafanti.admin.controller;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.controller.BaseApiController;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.crawler.RequestUtils;
-import com.goafanti.crawler.callback.TransitFutureCallback;
-import com.goafanti.fragment.service.FragmentService;
-
-@RestController
-@RequestMapping(value = "/api/admin/trigger")
-public class AdminTriggerController extends BaseApiController {
-
-	@Value(value = "${upload.path}")
-	private String			uploadPath	= null;
-
-	@Autowired
-	private FragmentService	fragmentService;
-
-	@RequestMapping(value = "/vacationcrawler", method = RequestMethod.GET)
-	public Result vacationCrawlerStart(String year) {
-		Result res = new Result();
-		if (StringUtils.isBlank(year)) {
-			return res.error(buildError("", "需要年份信息。"));
-		}
-		try {
-			TransitFutureCallback cb = new TransitFutureCallback("<a.*?href=\"(.*?)\".*?节假日安排.*?</a>");
-			Map<String, String> json = new HashMap<>();
-			cb.setResult(json);
-			RequestUtils.startRequest(
-					"http://sousuo.gov.cn/list.htm?n=40&p=0&t=paper&sort=pubtime&subchildtype=gc189&location=%E7%BB%BC%E5%90%88%E6%94%BF%E5%8A%A1%E5%85%B6%E4%BB%96&timetype=timeqb",
-					cb);
-			if (json.containsKey(year)) {
-				fragmentService.save("vacations" + year, json.get(year));
-			}
-			res.setData(json);
-		} catch (Exception e) {
-			res.getError().add(buildError("", e.getMessage()));
-		}
-		return res;
-	}
-}

+ 0 - 23
src/main/java/com/goafanti/common/dao/ValueEvaluationMapper.java

@@ -1,23 +0,0 @@
-package com.goafanti.common.dao;
-
-import java.util.Map;
-
-import com.goafanti.common.model.ValueEvaluation;
-
-public interface ValueEvaluationMapper {
-    int deleteByPrimaryKey(Long id);
-
-    int insert(ValueEvaluation record);
-
-    int insertSelective(ValueEvaluation record);
-
-    ValueEvaluation selectByPrimaryKey(Long id);
-
-    int updateByPrimaryKeySelective(ValueEvaluation record);
-
-    int updateByPrimaryKey(ValueEvaluation record);
-
-	ValueEvaluation selectByPrimaryKeyAndUser(Map<String, Object> params);
-	
-	int deleteRecords(Map<String, Object> params);
-}

+ 0 - 67
src/main/java/com/goafanti/common/mapper/HtmlFragmentMapper.xml

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.HtmlFragmentMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.HtmlFragment">
-    <id column="id" jdbcType="VARCHAR" property="id" />
-  </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.HtmlFragment">
-    <result column="content" jdbcType="LONGVARCHAR" property="content" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id
-  </sql>
-  <sql id="Blob_Column_List">
-    content
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
-    select 
-    <include refid="Base_Column_List" />
-    ,
-    <include refid="Blob_Column_List" />
-    from html_fragment
-    where id = #{id,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
-    delete from html_fragment
-    where id = #{id,jdbcType=VARCHAR}
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.HtmlFragment">
-    insert into html_fragment (id, content)
-    values (#{id,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
-    ON DUPLICATE KEY UPDATE 
-    content=values(content)
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.HtmlFragment">
-    insert into html_fragment
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="content != null">
-        content,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
-      <if test="content != null">
-        #{content,jdbcType=LONGVARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.HtmlFragment">
-    update html_fragment
-    <set>
-      <if test="content != null">
-        content = #{content,jdbcType=LONGVARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.HtmlFragment">
-    update html_fragment
-    set content = #{content,jdbcType=LONGVARCHAR}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-</mapper>

+ 0 - 164
src/main/java/com/goafanti/common/mapper/ValueEvaluationMapper.xml

@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.ValueEvaluationMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ValueEvaluation">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="uid" jdbcType="VARCHAR" property="uid" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="value" jdbcType="BIGINT" property="value" />
-    <result column="step" jdbcType="INTEGER" property="step" />
-    <result column="log" jdbcType="CHAR" property="log" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id, uid, create_time, name, value, step, log
-  </sql>
-  <sql id="Column_List">
-    id, uid, create_time, name, value, step
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from value_evaluation
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <select id="selectByPrimaryKeyAndUser" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from value_evaluation
-    where id = #{id,jdbcType=BIGINT} and uid = #{uid,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from value_evaluation
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.ValueEvaluation">
-    insert into value_evaluation (id, uid, create_time, 
-      name, value, step, log
-      )
-    values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{name,jdbcType=VARCHAR}, #{value,jdbcType=BIGINT}, #{step,jdbcType=INTEGER}, #{log,jdbcType=CHAR}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.ValueEvaluation">
-    insert into value_evaluation
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="uid != null">
-        uid,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="name != null">
-        name,
-      </if>
-      <if test="value != null">
-        value,
-      </if>
-      <if test="step != null">
-        step,
-      </if>
-      <if test="log != null">
-        log,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="uid != null">
-        #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="name != null">
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="value != null">
-        #{value,jdbcType=BIGINT},
-      </if>
-      <if test="step != null">
-        #{step,jdbcType=INTEGER},
-      </if>
-      <if test="log != null">
-        #{log,jdbcType=CHAR},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ValueEvaluation">
-    update value_evaluation
-    <set>
-      <if test="uid != null">
-        uid = #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="name != null">
-        name = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="value != null">
-        value = #{value,jdbcType=BIGINT},
-      </if>
-      <if test="step != null">
-        step = #{step,jdbcType=INTEGER},
-      </if>
-      <if test="log != null">
-        log = #{log,jdbcType=CHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ValueEvaluation">
-    update value_evaluation
-    set uid = #{uid,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      name = #{name,jdbcType=VARCHAR},
-      value = #{value,jdbcType=BIGINT},
-      step = #{step,jdbcType=INTEGER},
-      log = #{log,jdbcType=CHAR}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  
-  <select id="findUserListByPage" resultMap="BaseResultMap">
-  	select 
-    <include refid="Column_List" />
-    from value_evaluation
-    where 
-    uid = #{uid,jdbcType=VARCHAR}
-    <if test="name != null">
-      and name = #{name,jdbcType=VARCHAR},
-    </if>
-    order by id desc 
-    <if test="page_sql!=null">
-		${page_sql}
-	</if>
-  </select>
-  
-  <select id="findUserListCount" resultType="java.lang.Integer">
-  	select 
-    count(*)
-    from value_evaluation
-    where 
-    uid = #{uid,jdbcType=VARCHAR}
-    <if test="name != null">
-      and name = #{name,jdbcType=VARCHAR},
-    </if>
-  </select>
-  
-  <delete id="deleteRecords" parameterType="java.lang.Long">
-    delete from value_evaluation
-    where
-    id in 
-    <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
-		#{item,jdbcType=BIGINT}
-	</foreach>
-    <if test="uid != null">
-    	and uid = #{uid,jdbcType=VARCHAR}
-    </if>
-  </delete>
-</mapper>

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

@@ -1,50 +0,0 @@
-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;
-	}
-
-}

+ 0 - 102
src/main/java/com/goafanti/evaluation/bo/Step1.java

@@ -1,102 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-
-public class Step1 {
-
-	@NotNull
-	@Size(max = 128)
-	private String	name;
-
-	@NotNull
-	private Integer	industry;
-
-	@NotNull
-	@Size(max = 36)
-	private String	subIndustry;
-
-	@NotNull
-	private Integer	transferType;
-
-	@NotNull
-	private Integer	timeLeft;
-
-	@NotNull
-	@Size(max = 100)
-	private String	transferArea;
-
-	@NotNull
-	@Size(max = 36)
-	private String	currencyType;
-
-	@NotNull
-	@Pattern(regexp = "\\d{4}-\\d{2}-01")
-	private String	benchmarkDate;
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Integer getIndustry() {
-		return industry;
-	}
-
-	public void setIndustry(Integer industry) {
-		this.industry = industry;
-	}
-
-	public String getSubIndustry() {
-		return subIndustry;
-	}
-
-	public void setSubIndustry(String subIndustry) {
-		this.subIndustry = subIndustry;
-	}
-
-	public Integer getTransferType() {
-		return transferType;
-	}
-
-	public void setTransferType(Integer transferType) {
-		this.transferType = transferType;
-	}
-
-	public Integer getTimeLeft() {
-		return timeLeft;
-	}
-
-	public void setTimeLeft(Integer timeLeft) {
-		this.timeLeft = timeLeft;
-	}
-
-	public String getTransferArea() {
-		return transferArea;
-	}
-
-	public void setTransferArea(String transferArea) {
-		this.transferArea = transferArea;
-	}
-
-	public String getCurrencyType() {
-		return currencyType;
-	}
-
-	public void setCurrencyType(String currencyType) {
-		this.currencyType = currencyType;
-	}
-
-	public String getBenchmarkDate() {
-		return benchmarkDate;
-	}
-
-	public void setBenchmarkDate(String benchmarkDate) {
-		this.benchmarkDate = benchmarkDate;
-	}
-
-}

+ 0 - 79
src/main/java/com/goafanti/evaluation/bo/Step2.java

@@ -1,79 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.NotNull;
-
-public class Step2 {
-	@NotNull
-	@Max(value = 5)
-	private Integer	accessMethod;
-	
-	@NotNull
-	@Max(value = 5)
-	private Integer	legalStatus;
-	
-	@NotNull
-	@Max(value = 5)
-	private Integer	patentMaintenance;
-	
-	@NotNull
-	@Max(value = 5)
-	private Integer	confidentiality;
-	
-	@NotNull
-	@Max(value = 5)
-	private Integer	decidability;
-	
-	@NotNull
-	@Max(value = 5)
-	private Integer	hasRightLimitation;
-
-	public Integer getAccessMethod() {
-		return accessMethod;
-	}
-
-	public void setAccessMethod(Integer accessMethod) {
-		this.accessMethod = accessMethod;
-	}
-
-	public Integer getLegalStatus() {
-		return legalStatus;
-	}
-
-	public void setLegalStatus(Integer legalStatus) {
-		this.legalStatus = legalStatus;
-	}
-
-	public Integer getPatentMaintenance() {
-		return patentMaintenance;
-	}
-
-	public void setPatentMaintenance(Integer patentMaintenance) {
-		this.patentMaintenance = patentMaintenance;
-	}
-
-	public Integer getConfidentiality() {
-		return confidentiality;
-	}
-
-	public void setConfidentiality(Integer confidentiality) {
-		this.confidentiality = confidentiality;
-	}
-
-	public Integer getDecidability() {
-		return decidability;
-	}
-
-	public void setDecidability(Integer decidability) {
-		this.decidability = decidability;
-	}
-
-	public Integer getHasRightLimitation() {
-		return hasRightLimitation;
-	}
-
-	public void setHasRightLimitation(Integer hasRightLimitation) {
-		this.hasRightLimitation = hasRightLimitation;
-	}
-
-}

+ 0 - 128
src/main/java/com/goafanti/evaluation/bo/Step3.java

@@ -1,128 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.NotNull;
-
-public class Step3 {
-	@NotNull
-	@Max(value = 6)
-	private Integer	progressiveness;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	innovativeness;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	ripeness;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	alternatives;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	defensive;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	prospect;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	supplyAndDemand;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	rangeOfApplication;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	imitable;
-	
-	@NotNull
-	@Max(value = 6)
-	private Integer	profitability;
-
-	public Integer getProgressiveness() {
-		return progressiveness;
-	}
-
-	public void setProgressiveness(Integer progressiveness) {
-		this.progressiveness = progressiveness;
-	}
-
-	public Integer getInnovativeness() {
-		return innovativeness;
-	}
-
-	public void setInnovativeness(Integer innovativeness) {
-		this.innovativeness = innovativeness;
-	}
-
-	public Integer getRipeness() {
-		return ripeness;
-	}
-
-	public void setRipeness(Integer ripeness) {
-		this.ripeness = ripeness;
-	}
-
-	public Integer getAlternatives() {
-		return alternatives;
-	}
-
-	public void setAlternatives(Integer alternatives) {
-		this.alternatives = alternatives;
-	}
-
-	public Integer getDefensive() {
-		return defensive;
-	}
-
-	public void setDefensive(Integer defensive) {
-		this.defensive = defensive;
-	}
-
-	public Integer getProspect() {
-		return prospect;
-	}
-
-	public void setProspect(Integer prospect) {
-		this.prospect = prospect;
-	}
-
-	public Integer getSupplyAndDemand() {
-		return supplyAndDemand;
-	}
-
-	public void setSupplyAndDemand(Integer supplyAndDemand) {
-		this.supplyAndDemand = supplyAndDemand;
-	}
-
-	public Integer getRangeOfApplication() {
-		return rangeOfApplication;
-	}
-
-	public void setRangeOfApplication(Integer rangeOfApplication) {
-		this.rangeOfApplication = rangeOfApplication;
-	}
-
-	public Integer getImitable() {
-		return imitable;
-	}
-
-	public void setImitable(Integer imitable) {
-		this.imitable = imitable;
-	}
-
-	public Integer getProfitability() {
-		return profitability;
-	}
-
-	public void setProfitability(Integer profitability) {
-		this.profitability = profitability;
-	}
-	
-	
-}

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

@@ -1,25 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-import java.util.List;
-
-public class Step4 {
-	private Integer				hasIncome;
-	private List<YearIncome>	incomes;
-
-	public Integer getHasIncome() {
-		return hasIncome;
-	}
-
-	public void setHasIncome(Integer hasIncome) {
-		this.hasIncome = hasIncome;
-	}
-
-	public List<YearIncome> getIncomes() {
-		return incomes;
-	}
-
-	public void setIncomes(List<YearIncome> incomes) {
-		this.incomes = incomes;
-	}
-
-}

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

@@ -1,25 +0,0 @@
-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;
-	}
-
-}

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

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

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

@@ -1,67 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.NotNull;
-
-public class Step7 {
-	@NotNull
-	@Max(value = 6)
-	private Integer	political;
-
-	@NotNull
-	@Max(value = 6)
-	private Integer	technical;
-
-	@NotNull
-	@Max(value = 6)
-	private Integer	market;
-
-	@NotNull
-	@Max(value = 6)
-	private Integer	capital;
-
-	@NotNull
-	@Max(value = 6)
-	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;
-	}
-	
-}

+ 0 - 32
src/main/java/com/goafanti/evaluation/bo/YearIncome.java

@@ -1,32 +0,0 @@
-package com.goafanti.evaluation.bo;
-
-public class YearIncome {
-	private Integer	year;
-	private Long	income;
-	private Integer	profit;
-
-	public Integer getYear() {
-		return year;
-	}
-
-	public void setYear(Integer year) {
-		this.year = year;
-	}
-
-	public Long getIncome() {
-		return income;
-	}
-
-	public void setIncome(Long income) {
-		this.income = income;
-	}
-
-	public Integer getProfit() {
-		return profit;
-	}
-
-	public void setProfit(Integer profit) {
-		this.profit = profit;
-	}
-
-}

+ 0 - 578
src/main/java/com/goafanti/evaluation/controller/UserEvaluationApiController.java

@@ -1,578 +0,0 @@
-package com.goafanti.evaluation.controller;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.validation.Valid;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.Assert;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.BaseApiController;
-import com.goafanti.common.model.DistrictGlossory;
-import com.goafanti.common.model.IndustryCategory;
-import com.goafanti.common.model.ValueEvaluation;
-import com.goafanti.common.service.DistrictGlossoryService;
-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.enums.ProfitRate;
-import com.goafanti.evaluation.service.ValueEvaluationService;
-
-@RestController
-@RequestMapping(value = "/api/user/evaluate")
-public class UserEvaluationApiController extends BaseApiController {
-
-	@SuppressWarnings("unused")
-	private static final String			GOVERNMENT_LOAN_ROR	= "government_loan_ror";
-	private static final Logger			logger				= LoggerFactory.getLogger(UserEvaluationApiController.class);
-	private static final MathContext	DEFAULT_PRECISION	= new MathContext(4, RoundingMode.HALF_UP);
-
-	private static final String			STEP1				= "0";
-	private static final String			STEP2				= "1";
-	private static final String			STEP3				= "2";
-	private static final String			STEP4				= "3";
-	private static final String			STEP5				= "4";
-	private static final String			STEP6				= "5";
-	private static final String			STEP7				= "6";
-	private static final Integer[]		SCORES				= new Integer[] { 100, 80, 60, 40, 20, 0 };
-	private static final Integer[]		DISCOUNT_SCORES		= new Integer[] { 1, 2, 3, 4, 5 };
-	private static final BigDecimal		MIN_RATE			= new BigDecimal(2);
-	private static final BigDecimal		MAX_RATE			= new BigDecimal(6);
-	private static final BigDecimal		HUNDRED				= new BigDecimal(100);
-	private static final BigDecimal		PERCENTAGE			= new BigDecimal(0.01, DEFAULT_PRECISION);
-
-	@Autowired
-	ValueEvaluationService				valueEvaluationService;
-	@Autowired
-	private DistrictGlossoryService		districtGlossoryService;
-	@Autowired
-	private IndustryCategoryService		industryCategoryService;
-
-
-	@RequestMapping(value = "/create", method = RequestMethod.GET)
-	public Result create() {
-		ValueEvaluation ve = new ValueEvaluation();
-		ve.setUid(TokenManager.getUserId());
-		ve.setStep(0);
-		ve.setValue(0l);
-		ve.setLog("{}");
-		valueEvaluationService.insert(ve);
-		return new Result(ve.getId().toString());
-	}
-
-	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	public Result list(String pageNo, String pageSize) {
-		return new Result().data(valueEvaluationService.list(handlePageNo(pageNo), handlePageSize(pageSize)));
-	}
-
-	@RequestMapping(value = "/info/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
-	public Result info(@PathVariable String id) {
-		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
-		ValueEvaluation ve = valueEvaluationService.getMyEvaluation(Long.valueOf(id));
-		Assert.notNull(ve, ErrorConstants.EVALUATE_ID);
-		Map<String, Object> res = new HashMap<>();
-		res.put("name", ve.getName());
-		res.put("step", ve.getStep());
-		res.put("value", ve.getValue());
-		res.put("steps", JSON.parse(ve.getLog()));
-		return new Result().data(res);
-	}
-
-	@RequestMapping(value = "/remove", method = RequestMethod.POST)
-	public Result remove(String ids) {
-		Assert.isTrue(StringUtils.isNotBlank(ids), ErrorConstants.EVALUATE_PARAM);
-		Result res = new Result();
-		List<Long> idList = new ArrayList<>();
-		String[] idArr = ids.split(",");
-		for (String id : idArr) {
-			Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_PARAM);
-			idList.add(Long.valueOf(id));
-		}
-		res.data(valueEvaluationService.deleteMySteps(idList));
-		return res;
-	}
-
-	@RequestMapping(value = "/step1", method = RequestMethod.POST)
-	public Result step1(String id, @Valid Step1 data, BindingResult bindingResult) {
-		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
-		Result res = new Result();
-		if (handleBindingError(res, bindingResult)) {
-			return res;
-		}
-		updateSteps(data, 1, "0", res, id);
-		return res;
-	}
-
-	@RequestMapping(value = "/step2", method = RequestMethod.POST)
-	public Result step2(String id, @Valid Step2 data, BindingResult bindingResult) {
-		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
-		Result res = new Result();
-		if (handleBindingError(res, bindingResult)) {
-			return res;
-		}
-		updateSteps(data, 2, STEP2, res, id);
-		return res;
-	}
-
-	@RequestMapping(value = "/step3", method = RequestMethod.POST)
-	public Result step3(String id, @Valid Step3 data, BindingResult bindingResult) {
-		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
-		Result res = new Result();
-		if (handleBindingError(res, bindingResult)) {
-			return res;
-		}
-		updateSteps(data, 3, STEP3, res, id);
-		return res;
-	}
-
-	@RequestMapping(value = "/step4", method = RequestMethod.POST)
-	public Result step4(String id, String hasIncome, String incomes) {
-		Assert.isTrue(StringUtils.isNumeric(id), ErrorConstants.EVALUATE_ID);
-		Result res = new Result();
-		Step4 step = new Step4();
-		try {
-			step.setHasIncome(Integer.valueOf(hasIncome));
-			if (step.getHasIncome().equals(2)) {
-				List<YearIncome> ja = JSON.parseArray(incomes, YearIncome.class);
-				if (ja.size() != 3) {
-					res.error(buildError(ErrorConstants.EVALUATE_PARAM));
-				} else {
-					step.setIncomes(ja);
-				}
-			}
-		} catch (Exception e) {
-			res.error(buildError(ErrorConstants.EVALUATE_PARAM));
-		}
-		if (res.getError().isEmpty()) {
-			updateSteps(step, 4, STEP4, res, id);
-		}
-		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, STEP5, 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);
-		Result res = new Result();
-		ValueEvaluation ve = valueEvaluationService.getMyEvaluation(Long.valueOf(id));
-		try {
-			JSONObject jo = JSON.parseObject(ve.getLog());
-			Step4 step4 = ((JSON) jo.get(STEP4)).toJavaObject(Step4.class);
-			if (step4.getHasIncome().equals(2)) {
-				Step1 step1 = ((JSON) jo.get(STEP1)).toJavaObject(Step1.class);
-				res.data(calcForecastIncome(step4.getIncomes(), getIndustryCategoryValue(step1)));
-			}
-		} catch (Exception e) {
-			res.error(buildError(ErrorConstants.EVALUATE_PARAM));
-		}
-		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, STEP6, 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, STEP7, res, id);
-		return res;
-	}
-
-	@RequestMapping(value = "/calc/{id}", method = RequestMethod.GET)
-	public Result calc(@PathVariable String id) {
-		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 {
-			Long value = calcValue(ve, new HashMap<>());
-			res.data(value);
-			ValueEvaluation upt = new ValueEvaluation();
-			upt.setId(ve.getId());
-			upt.setValue(value);
-			valueEvaluationService.update(upt);
-		}
-		return res;
-	}
-
-	@RequestMapping(value = "/report/{id}", method = RequestMethod.GET)
-	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);
-		}
-		return res;
-	}
-
-	private Long calcValue(ValueEvaluation ve, Map<String, Object> result) {
-		JSONObject log = JSON.parseObject(ve.getLog());
-		Step1 step1 = ((JSON) log.get(STEP1)).toJavaObject(Step1.class);
-		Step2 step2 = ((JSON) log.get(STEP2)).toJavaObject(Step2.class);
-		Step3 step3 = ((JSON) log.get(STEP3)).toJavaObject(Step3.class);
-		Step5 step5 = ((JSON) log.get(STEP5)).toJavaObject(Step5.class);
-		Step6 step6 = ((JSON) log.get(STEP6)).toJavaObject(Step6.class);
-		Step7 step7 = ((JSON) log.get(STEP7)).toJavaObject(Step7.class);
-		Integer timeLeft = step1.getTimeLeft();
-		timeLeft = timeLeft < 3 ? 3 : timeLeft > 10 ? 10 : timeLeft; // 剩余经济寿命最低3,最大10年
-		Map<Integer, IndustryCategory> subs = getIndustryCates(step1.getIndustry());
-
-		Map<Integer, DistrictGlossory> provinces = getProvinces();
-
-		result.put("subIndustries", Stream.of(step1.getSubIndustry().split(",")).map(it -> {
-			return subs.get(Integer.valueOf(it)).getName();
-		}).collect(Collectors.joining(",")));
-
-		result.put("transferArea", Stream.of(step1.getTransferArea().split(",")).map(it -> {
-			return it.equals("0") ? "中国全境" : provinces.get(Integer.valueOf(it)).getName();
-		}).collect(Collectors.joining(",")));
-
-		result.put("industry", industryCategoryService.list(0).stream().filter(it -> {
-			return it.getId().equals(step1.getIndustry());
-		}).findFirst().get().getName());
-
-		BigDecimal industryAverageRate = getIndustryCategoryValue(step1, subs);
-		List<Long> userForecast = step5.getForecastIncomes().stream().map(fc -> {
-			return fc.getIncome();
-		}).collect(Collectors.toList());
-		List<Long> sysForecast = calcSysForecast(userForecast, industryAverageRate, timeLeft);
-		calcUserForecast(userForecast, timeLeft);
-		List<Long> measuredForecast = calcMeasuredForecast(userForecast, sysForecast);
-
-		Map<String, Integer> profitScores = getProfitScores(step2, step3);
-		Map<String, Integer> discountRates = getDiscountRates(step7);
-
-		BigDecimal profitRate = calcProfitRate(profitScores, step1.getIndustry(), result);
-
-		/*BigDecimal governmentLoanRoR = new BigDecimal(sysDictService.getValue(GOVERNMENT_LOAN_ROR),
-				MathContext.DECIMAL32);*/
-		BigDecimal governmentLoanRoR = new BigDecimal(0);
-		BigDecimal taxRate = new BigDecimal(step6.getTaxRate());
-
-		BigDecimal discountRate = calcDiscountRate(discountRates, taxRate, governmentLoanRoR);
-		result.put("userForecast", userForecast);
-		result.put("sysForecast", sysForecast);
-		result.put("measuredForecast", measuredForecast);
-		result.put("profitRate", profitRate);
-		result.put("governmentLoanRoR", governmentLoanRoR);
-		result.put("industryAverageRate", industryAverageRate);
-		result.put("discountRate", discountRate);
-		result.put("benchmarkDate", step1.getBenchmarkDate());
-		result.put("timeLeft", timeLeft);
-		result.put("name", step1.getName());
-		Long value = calcTotal(measuredForecast, profitRate, discountRate, result);
-		result.put("value", value);
-		result.put("log", log);
-		return value;
-	}
-
-	private Long calcTotal(List<Long> measuredForecast, BigDecimal profitRate, BigDecimal discountRate,
-			Map<String, Object> result) {
-		List<Long> profitList = new ArrayList<>();
-		BigDecimal total = BigDecimal.ZERO;
-		BigDecimal incomeDiscount = BigDecimal.ZERO;
-		double discountTerm = 0.5;
-		int index = 0;
-		BigDecimal discountFactor = BigDecimal.ZERO;
-		for (Long val : measuredForecast) {
-			incomeDiscount = new BigDecimal(val).multiply(profitRate);
-			profitList.add(incomeDiscount.longValue());
-			discountFactor = BigDecimal.ONE.divide(BigDecimal.ONE.add(discountRate), 4, RoundingMode.FLOOR);
-			discountTerm += index;
-			double pow = Math.pow(discountFactor.doubleValue(), discountTerm);
-			total = total.add(incomeDiscount.multiply(new BigDecimal(pow)));
-			index++;
-		}
-		result.put("profitList", profitList); // 收入分成额
-		return total.longValue();
-	}
-
-	private BigDecimal calcDiscountRate(Map<String, Integer> discountRates, BigDecimal taxRate,
-			BigDecimal governmentLoanRoR) {
-		BigDecimal discountRate = new BigDecimal(discountRates.get("capital"))
-				.add(new BigDecimal(discountRates.get("management"))).add(new BigDecimal(discountRates.get("market")))
-				.add(new BigDecimal(discountRates.get("political")))
-				.add(new BigDecimal(discountRates.get("technical")));
-		discountRate = discountRate.add(governmentLoanRoR).divide(HUNDRED.subtract(taxRate), 4, RoundingMode.FLOOR);
-		double rate = discountRate.doubleValue();
-		rate = rate > 0.3 ? 0.3 : rate < 0.17 ? 0.17 : rate;
-		discountRate = new BigDecimal(rate, DEFAULT_PRECISION);
-		return discountRate;
-	}
-
-	private Map<String, Integer> getDiscountRates(Step7 step7) {
-		Map<String, Integer> profitScores = new HashMap<>();
-		profitScores.put("capital", getDiscountScore(step7.getCapital()));// 资金风险
-		profitScores.put("management", getDiscountScore(step7.getManagement()));// 管理风险
-		profitScores.put("market", getDiscountScore(step7.getMarket()));// 市场风险
-		profitScores.put("political", getDiscountScore(step7.getPolitical()));// 政策风险
-		profitScores.put("technical", getDiscountScore(step7.getTechnical()));// 技术风险
-		return profitScores;
-	}
-
-	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;
-
-		BigDecimal profitRate = new BigDecimal(profitScores.get("confidentiality")).multiply(legalFactor)
-				.multiply(new BigDecimal(0.4, DEFAULT_PRECISION));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("legalStatus")).multiply(legalFactor)
-				.multiply(new BigDecimal(0.3, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("decidability")).multiply(legalFactor)
-				.multiply(new BigDecimal(0.3, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("prospect")).multiply(techFactor)
-				.multiply(new BigDecimal(0.1, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("alternatives")).multiply(techFactor)
-				.multiply(new BigDecimal(0.2, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("progressiveness")).multiply(techFactor)
-				.multiply(new BigDecimal(0.2, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("innovativeness")).multiply(techFactor)
-				.multiply(new BigDecimal(0.1, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("ripeness")).multiply(techFactor)
-				.multiply(new BigDecimal(0.2, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("rangeOfApplication")).multiply(techFactor)
-				.multiply(new BigDecimal(0.1, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("defensive")).multiply(techFactor)
-				.multiply(new BigDecimal(0.1, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("supplyAndDemand")).multiply(fundFactor)
-				.multiply(new BigDecimal(0.6, DEFAULT_PRECISION)));
-		profitRate = profitRate.add(new BigDecimal(profitScores.get("profitability")).multiply(fundFactor)
-				.multiply(new BigDecimal(0.4, DEFAULT_PRECISION)));
-
-		BigDecimal minRate = MIN_RATE;
-		BigDecimal maxRate = MAX_RATE;
-		if (ProfitRate.containsType(industry)) {
-			ProfitRate pr = ProfitRate.getProfitRate(industry);
-			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);
-
-		return profitRate;
-	}
-
-	private Map<String, Integer> getProfitScores(Step2 step2, Step3 step3) {
-		// 法律因素权重 20%
-		Map<String, Integer> profitScores = new HashMap<>();
-		profitScores.put("legalStatus", getScore(step2.getLegalStatus()));// 法律状态
-		profitScores.put("confidentiality", getScore(step2.getConfidentiality()));// 保密性
-		profitScores.put("decidability", getScore(step2.getDecidability()));// 侵权可判定性
-		// 技术因素权重 60%
-		profitScores.put("prospect", getScore(step3.getProspect()));// 领域前景
-		profitScores.put("alternatives", getScore(step3.getAlternatives()));// 可替代性
-		profitScores.put("progressiveness", getScore(step3.getProgressiveness()));// 先进性
-		profitScores.put("innovativeness", getScore(step3.getInnovativeness()));// 创新性
-		profitScores.put("ripeness", getScore(step3.getRipeness()));// 成熟度
-		profitScores.put("rangeOfApplication", getScore(step3.getRangeOfApplication()));// 应用范围
-		profitScores.put("defensive", getScore(step3.getDefensive()));// 应用范围
-		// 经济因素 20%
-		profitScores.put("supplyAndDemand", getScore(step3.getSupplyAndDemand()));// 供求关系
-		profitScores.put("profitability", getScore(step3.getProfitability()));// 独立获利能力
-
-		return profitScores;
-	}
-
-	private Integer getScore(int option) {
-		int idx = option - 1;
-		idx = idx < 0 ? 0 : idx >= SCORES.length ? SCORES.length - 1 : idx;
-		return SCORES[idx];
-	}
-
-	private Integer getDiscountScore(int option) {
-		int idx = option - 1;
-		idx = idx < 0 ? 0 : idx >= DISCOUNT_SCORES.length ? DISCOUNT_SCORES.length - 1 : idx;
-		return DISCOUNT_SCORES[idx];
-	}
-
-	private void calcUserForecast(List<Long> userForecast, Integer timeLeft) {
-		Assert.isTrue(userForecast.get(0) > 0 && userForecast.get(1) > 0, ErrorConstants.EVALUATE_PARAM);
-		BigDecimal second = new BigDecimal(userForecast.get(1));
-		BigDecimal lastYear = new BigDecimal(userForecast.get(2));
-		BigDecimal rate = lastYear.divide(second, 2, RoundingMode.HALF_UP)
-				.subtract(BigDecimal.ONE).add(second
-						.divide(new BigDecimal(userForecast.get(0)), 2, RoundingMode.HALF_UP).subtract(BigDecimal.ONE))
-				.divide(new BigDecimal(2));
-		BigDecimal step = new BigDecimal(0.1, DEFAULT_PRECISION);
-		int size = userForecast.size();
-		for (int i = size; i < timeLeft; i++) {
-			if (i < 6) {
-				lastYear = lastYear.multiply(
-						BigDecimal.ONE.add(rate.multiply(rate.subtract(step.multiply(new BigDecimal(i - size))))));
-			}
-			userForecast.add(lastYear.longValue());
-		}
-	}
-
-	private List<Long> calcSysForecast(List<Long> userForecast, BigDecimal industryAverageRate, Integer timeLeft) {
-		List<Long> sysForecast = new ArrayList<>();
-		BigDecimal lastYear = BigDecimal.ZERO;
-		BigDecimal step = new BigDecimal(0.1, DEFAULT_PRECISION);
-		industryAverageRate = industryAverageRate.multiply(PERCENTAGE);
-		for (int i = 0; i < timeLeft; i++) {
-			if (i == 0) {
-				lastYear = new BigDecimal(userForecast.get(0)).multiply(new BigDecimal(0.9, DEFAULT_PRECISION));
-			} else if (i < 6) {
-				lastYear = lastYear.multiply(BigDecimal.ONE.add(
-						industryAverageRate.multiply(BigDecimal.ONE.subtract(step.multiply(new BigDecimal(i - 1))))));
-			}
-			sysForecast.add(lastYear.longValue());
-		}
-		return sysForecast;
-	}
-
-	private List<Long> calcMeasuredForecast(List<Long> userForecast, List<Long> sysForecast) {
-		List<Long> measuredForecast = new ArrayList<>();
-		for (int i = 0; i < sysForecast.size(); i++) {
-			measuredForecast.add((userForecast.get(i) + sysForecast.get(i)) >> 1);
-		}
-		return measuredForecast;
-	}
-
-	private void updateSteps(Object step, Integer nextStep, String key, Result res, String id) {
-		ValueEvaluation ve = valueEvaluationService.getMyEvaluation(Long.valueOf(id));
-		Assert.notNull(ve, ErrorConstants.EVALUATE_ID);
-		ve.setStep(Math.max(nextStep, ve.getStep()));
-		if (nextStep == 1) {
-			ve.setName(((Step1) step).getName());
-		}
-		ve.setValue(0l);
-		JSONObject jo = JSON.parseObject(ve.getLog());
-		jo.put(key, step);
-		ve.setLog(jo.toJSONString());
-		res.data(valueEvaluationService.update(ve));
-	}
-
-	private boolean handleBindingError(Result res, BindingResult bindingResult) {
-		if (bindingResult.hasErrors()) {
-			LoggerUtils.debug(logger, "参数错误:[%s], [%s], [%s]", bindingResult.getFieldError().getDefaultMessage(),
-					bindingResult.getFieldError().getField(), bindingResult.getFieldError().getRejectedValue());
-			res.getError().add(buildError(ErrorConstants.EVALUATE_PARAM));
-			return true;
-		}
-		return false;
-	}
-
-	private BigDecimal getIndustryCategoryValue(Step1 step1) {
-		return getIndustryCategoryValue(step1, getIndustryCates(step1.getIndustry()));
-	}
-
-	private Map<Integer, IndustryCategory> getIndustryCates(Integer pid) {
-		return industryCategoryService.list(pid).stream()
-				.collect(Collectors.toMap(IndustryCategory::getId, (it) -> it));
-	}
-
-	private Map<Integer, DistrictGlossory> getProvinces() {
-		return districtGlossoryService.list(0).stream().collect(Collectors.toMap(DistrictGlossory::getId, (it) -> it));
-	}
-
-	private BigDecimal getIndustryCategoryValue(Step1 step1, Map<Integer, IndustryCategory> cates) {
-		List<Integer> subIds = Stream.of(step1.getSubIndustry().split(",")).map(it -> {
-			return Integer.valueOf(it);
-		}).collect(Collectors.toList());
-		BigDecimal average = BigDecimal.ZERO;
-		int count = 0;
-		for (Integer id : subIds) {
-			if (cates.containsKey(id)) {
-				average = average.add(cates.get(id).getValue());
-				count++;
-			}
-		}
-		return average.divide(new BigDecimal(count == 0 ? 1 : count), 2, RoundingMode.HALF_UP);
-	}
-
-	@SuppressWarnings("unlikely-arg-type")
-	private Long[] calcForecastIncome(List<YearIncome> incomes, BigDecimal growth) {
-		BigDecimal useGrowth = growth.multiply(PERCENTAGE);
-		BigDecimal base = new BigDecimal(incomes.get(0).getIncome());
-		if (!incomes.get(1).getIncome().equals(0)) {
-			useGrowth = base.divide(new BigDecimal(incomes.get(1).getIncome()), 2, RoundingMode.CEILING)
-					.subtract(BigDecimal.ONE);
-		}
-		Long[] res = new Long[3];
-		BigDecimal one = base.multiply(useGrowth.add(BigDecimal.ONE));
-		useGrowth = useGrowth.multiply(new BigDecimal(0.9, DEFAULT_PRECISION));
-		BigDecimal two = one.multiply(useGrowth.add(BigDecimal.ONE));
-		useGrowth = useGrowth.multiply(new BigDecimal(0.8, DEFAULT_PRECISION));
-		res[2] = two.multiply(useGrowth.add(BigDecimal.ONE)).longValue();
-		res[0] = one.longValue();
-		res[1] = two.longValue();
-		return res;
-	}
-}

+ 0 - 81
src/main/java/com/goafanti/evaluation/enums/ProfitRate.java

@@ -1,81 +0,0 @@
-package com.goafanti.evaluation.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum ProfitRate {
-	CJ(1, "采掘", 2, 6),
-	HG(2, "化工", 2, 3.5),
-	GT(3, "钢铁", 2, 6),
-	JZCL(4, "建筑材料", 2, 6),
-	JZZS(5, "建筑装饰", 2, 6),
-	DQSB(6, "电气设备", 3, 4.5),
-	JXSB(7, "机械设备", 1.5, 3),
-	GFJG(8, "国防军工", 2, 6),
-	QC(9, "汽车", 2, 6),
-	JYDQ(10, "家用电器", 1, 2.5),
-	FZFZ(11, "纺织服装", 1, 2.5),
-	QGZZ(12, "轻工制造", 2, 6),
-	SYMY(13, "商业贸易", 1, 2.5),
-	NLMY(14, "农林牧渔", 2, 6),
-	SPYL(15, "食品饮料", 1, 2.5),
-	XXFW(16, "休闲服务", 1, 2.5),
-	YYSW(17, "医药生物", 2.5, 4),
-	GGSY(18, "公用事业", 2, 6),
-	JTYS(19, "交通运输", 2, 6),
-	FDC(20, "房地产", 2, 6),
-	DZ(21, "电子", 7, 10),
-	JSJ(22, "计算机", 4, 5.5),
-	CM(23, "传媒", 2, 6),
-	TX(24, "通信", 2, 6),
-	YH(25, "银行", 2, 6);
-
-	private Integer							id;
-	private String							desc;
-	private double							minRate;
-	private double							maxRate;
-
-	private static Map<Integer, ProfitRate>	map	= new HashMap<Integer, ProfitRate>();
-
-	private ProfitRate(Integer id, String desc, double minRate, double maxRate) {
-		this.id = id;
-		this.desc = desc;
-		this.minRate = minRate;
-		this.maxRate = maxRate;
-	}
-
-	static {
-		for (ProfitRate value : ProfitRate.values()) {
-			map.put(value.getId(), value);
-		}
-	}
-
-	public static ProfitRate getProfitRate(Integer code) {
-		return map.get(code);
-	}
-
-	public static String getFieldDesc(Integer code) {
-		return containsType(code) ? getProfitRate(code).getDesc() : "";
-	}
-
-	public static boolean containsType(Integer code) {
-		return map.containsKey(code);
-	}
-
-	public Integer getId() {
-		return id;
-	}
-
-	public String getDesc() {
-		return desc;
-	}
-
-	public double getMinRate() {
-		return minRate;
-	}
-
-	public double getMaxRate() {
-		return maxRate;
-	}
-
-}

+ 0 - 57
src/main/java/com/goafanti/evaluation/service/ValueEvaluationService.java

@@ -1,57 +0,0 @@
-package com.goafanti.evaluation.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.goafanti.common.dao.ValueEvaluationMapper;
-import com.goafanti.common.model.ValueEvaluation;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.mybatis.JDBCIdGenerator;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.core.shiro.token.TokenManager;
-
-@Service
-@Transactional
-public class ValueEvaluationService extends BaseMybatisDao<ValueEvaluationMapper> {
-	@Autowired
-	ValueEvaluationMapper	valueEvaluationMapper;
-
-	@Autowired
-	JDBCIdGenerator			idGenerator;
-
-	public int insert(ValueEvaluation ve) {
-		ve.setId(idGenerator.generateId());
-		return valueEvaluationMapper.insertSelective(ve);
-	}
-
-	public int update(ValueEvaluation ve) {
-		return valueEvaluationMapper.updateByPrimaryKeySelective(ve);
-	}
-
-	public ValueEvaluation getMyEvaluation(Long id) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("uid", TokenManager.getUserId());
-		params.put("id", id);
-		return valueEvaluationMapper.selectByPrimaryKeyAndUser(params);
-	}
-
-	public int deleteMySteps(List<Long> ids) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("uid", TokenManager.getUserId());
-		params.put("ids", ids);
-		return valueEvaluationMapper.deleteRecords(params);
-	}
-
-	@SuppressWarnings("unchecked")
-	public Pagination<ValueEvaluation> list(Integer pageNo, Integer pageSize) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("uid", TokenManager.getUserId());
-		return (Pagination<ValueEvaluation>) findPage("findUserListByPage", "findUserListCount", params, pageNo,
-				pageSize);
-	}
-}

+ 0 - 33
src/main/java/com/goafanti/fragment/controller/FragmentController.java

@@ -1,33 +0,0 @@
-package com.goafanti.fragment.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.goafanti.common.controller.BaseApiController;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.fragment.service.FragmentService;
-
-@RestController
-@RequestMapping(value = "/open/html/")
-public class FragmentController extends BaseApiController {
-
-	@Autowired
-	FragmentService fragmentService;
-
-	@RequestMapping(value = "/get/{id}", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")
-	public String get(@PathVariable String id, String noCache) {
-		if (StringUtils.isNotBlank(noCache)) {
-			fragmentService.clean(id);
-		}
-		return fragmentService.selectById(id);
-	}
-
-	@RequestMapping(value = "/json/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
-	public String json(@PathVariable String id) {
-		return fragmentService.selectById(id);
-	}
-
-}

+ 0 - 45
src/main/java/com/goafanti/fragment/service/FragmentService.java

@@ -1,45 +0,0 @@
-package com.goafanti.fragment.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.goafanti.common.dao.HtmlFragmentMapper;
-import com.goafanti.common.model.HtmlFragment;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-
-@Service
-@Transactional
-public class FragmentService extends BaseMybatisDao<HtmlFragmentMapper> {
-	@Autowired
-	HtmlFragmentMapper htmlFragmentMapper;
-	
-	private static final Logger	logger	= LoggerFactory.getLogger(FragmentService.class);
-
-	@Cacheable(value = "HtmlFragmentCache", key = "'HtmlFragment:'+#id")
-	public String selectById(String id) {
-		HtmlFragment hf = htmlFragmentMapper.selectByPrimaryKey(id);
-		return hf == null ? "" : hf.getContent();
-	}
-	
-	@CacheEvict(value = "HtmlFragmentCache", key = "'HtmlFragment:'+#id")
-	public void clean(String id) {
-		LoggerUtils.debug(logger, "清除页面缓存:[%s]", id);
-	}
-
-	@CachePut(value = "HtmlFragmentCache", key = "'HtmlFragment:'+#id")
-	public String save(String id, String content) {
-		HtmlFragment hf = new HtmlFragment();
-		hf.setContent(content);
-		hf.setId(id);
-		htmlFragmentMapper.insert(hf);
-		return content;
-	}
-
-}