Просмотр исходного кода

Accept Merge Request #222 合并 : (master -> prod)

Merge Request: 合并
Created By: @albertshaw
Accepted By: @albertshaw
URL: https://coding.net/t/aft/p/AFT/git/merge/222
albertshaw лет назад: 8
Родитель
Сommit
2b11136126

+ 40 - 0
schema/20170816-appconfig.sql

@@ -0,0 +1,40 @@
+CREATE TABLE `app_config` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `cate` varchar(45) DEFAULT NULL COMMENT '分类',
+  `key` varchar(45) DEFAULT NULL COMMENT '关键字',
+  `name` varchar(45) DEFAULT NULL COMMENT '名称',
+  `value` varchar(45) DEFAULT NULL COMMENT '值',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
+
+
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'demand', '需求', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'achievement', '成果', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'expert', '专家', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'company', '企业', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'school', '高校', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'institute', '院所', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'policy', '政策', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'activity', '活动', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('collections', 'news', '快讯', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'hightech', '高企', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'program', '科技项目', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'patent', '专利', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'copyright', '软著', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'evalution', '评估', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'activity', '活动', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'crowdfunding', '众筹', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'achievement', '买技术', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'demand', '接需求', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'date', '邀约专家', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('orders', 'consultant', '技术咨询', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mytech', 'match', '匹配', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mytech', 'intention', '意向', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mytech', 'deal', '成交', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('myexpert', 'date', '邀约', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('myexpert', 'intention', '意向', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('myexpert', 'deal', '成交', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mydemand', 'match', '匹配', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mydemand', 'intention', '意向', '1');
+INSERT INTO `app_config` (`cate`, `key`, `name`, `value`) VALUES ('mydemand', 'deal', '成交', '1');
+

+ 35 - 0
src/main/java/com/goafanti/app/controller/MyAppApiController.java

@@ -0,0 +1,35 @@
+package com.goafanti.app.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.app.service.AppConfigService;
+import com.goafanti.app.service.MyAppService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.utils.StringUtils;
+
+@RestController
+@RequestMapping(path = "/api/app", method = RequestMethod.GET)
+public class MyAppApiController extends BaseApiController {
+
+	@Autowired
+	AppConfigService	appConfigService;
+	@Autowired
+	MyAppService		myAppService;
+
+	@RequestMapping(value = "/config", method = RequestMethod.GET)
+	public Result config(String noCache) {
+		if (StringUtils.equals(noCache, "1")) {
+			appConfigService.cleanList();
+		}
+		return res().data(appConfigService.findPortalAppConfigs());
+	}
+
+	@RequestMapping(value = "/count", method = RequestMethod.GET)
+	public Result count(String cate) {
+		return res().data(myAppService.countByCate(cate));
+	}
+}

+ 48 - 0
src/main/java/com/goafanti/app/enums/MyAppCountCategory.java

@@ -0,0 +1,48 @@
+package com.goafanti.app.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum MyAppCountCategory {
+	COLLECTIONS("collections", "收藏"),
+	ORDERS("orders", "订单"),
+	MYDEMAND("mydemand", "我的需求"),
+	MYTECH("mytech", "我的技术"),
+	MYEXPERT("myexpert", "我的专家"),
+	UNKNOWN("", "未知");
+
+	private MyAppCountCategory(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<String, MyAppCountCategory> status = new HashMap<String, MyAppCountCategory>();
+
+	static {
+		for (MyAppCountCategory value : MyAppCountCategory.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static MyAppCountCategory getStatus(String code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return UNKNOWN;
+	}
+
+	public static boolean containsType(String code) {
+		return status.containsKey(code);
+	}
+
+	private String	code;
+	private String	desc;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+}

+ 34 - 0
src/main/java/com/goafanti/app/service/AppConfigService.java

@@ -0,0 +1,34 @@
+package com.goafanti.app.service;
+
+import java.util.List;
+
+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.Cacheable;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.dao.AppConfigMapper;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+
+@Service
+public class AppConfigService extends BaseMybatisDao<AppConfigMapper> {
+	@Autowired
+	AppConfigMapper				appConfigMapper;
+
+	private static final Logger	logger	= LoggerFactory.getLogger(AppConfigService.class);
+
+	@Cacheable(value = "AppConfigListCache", key = "'AppConfigList'")
+	public List<JSONObject> findPortalAppConfigs() {
+		return appConfigMapper.findList();
+	}
+
+	@CacheEvict(value = "AppConfigListCache", key = "'AppConfigList'")
+	public void cleanList() {
+		LoggerUtils.debug(logger, "清除app配置列表缓存");
+	}
+
+}

+ 40 - 0
src/main/java/com/goafanti/app/service/MyAppService.java

@@ -0,0 +1,40 @@
+package com.goafanti.app.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+
+import com.goafanti.app.enums.MyAppCountCategory;
+import com.goafanti.common.dao.MyAppMapper;
+import com.goafanti.core.shiro.token.TokenManager;
+
+@Service
+public class MyAppService {
+	@Autowired
+	MyAppMapper myAppMapper;
+
+	public ModelMap countByCate(String cate) {
+		ModelMap res = null;
+		switch (MyAppCountCategory.getStatus(cate)) {
+		case COLLECTIONS:
+			res = myAppMapper.countCollections(TokenManager.getUserId());
+			break;
+		case MYDEMAND:
+			res = myAppMapper.countMyDemand(TokenManager.getUserId());
+			break;
+//		case MYEXPERT:
+//			res = myAppMapper.countMyExpert(TokenManager.getUserId());
+//			break;
+		case MYTECH:
+			res = myAppMapper.countMyTech(TokenManager.getUserId());
+			break;
+		case ORDERS:
+			res = myAppMapper.countOrders(TokenManager.getUserId());
+			break;
+		default:
+			res = new ModelMap();
+			break;
+		}
+		return res;
+	}
+}

+ 22 - 0
src/main/java/com/goafanti/common/dao/AppConfigMapper.java

@@ -0,0 +1,22 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.model.AppConfig;
+
+public interface AppConfigMapper {
+	int deleteByPrimaryKey(Integer id);
+
+	int insert(AppConfig record);
+
+	int insertSelective(AppConfig record);
+
+	AppConfig selectByPrimaryKey(Integer id);
+
+	int updateByPrimaryKeySelective(AppConfig record);
+
+	int updateByPrimaryKey(AppConfig record);
+
+	List<JSONObject> findList();
+}

+ 16 - 0
src/main/java/com/goafanti/common/dao/MyAppMapper.java

@@ -0,0 +1,16 @@
+package com.goafanti.common.dao;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.ui.ModelMap;
+
+public interface MyAppMapper {
+	ModelMap countCollections(@Param("uid") String uid);
+
+	ModelMap countOrders(@Param("uid") String uid);
+
+	ModelMap countMyTech(@Param("uid") String uid);
+
+	ModelMap countMyDemand(@Param("uid") String uid);
+
+	ModelMap countMyExpert(@Param("uid") String uid);
+}

+ 98 - 0
src/main/java/com/goafanti/common/mapper/AppConfigMapper.xml

@@ -0,0 +1,98 @@
+<?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.AppConfigMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AppConfig">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="cate" jdbcType="VARCHAR" property="cate" />
+    <result column="key" jdbcType="VARCHAR" property="key" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="value" jdbcType="VARCHAR" property="value" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    `id`, `cate`, `key`, `name`, `value`
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from app_config
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from app_config
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.AppConfig">
+    insert into app_config (`id`, `cate`, `key`, 
+      `name`, `value`)
+    values (#{id,jdbcType=INTEGER}, #{cate,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, 
+      #{name,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.AppConfig">
+    insert into app_config
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        `id`,
+      </if>
+      <if test="cate != null">
+        `cate`,
+      </if>
+      <if test="key != null">
+        `key`,
+      </if>
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="value != null">
+        `value`,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="cate != null">
+        #{cate,jdbcType=VARCHAR},
+      </if>
+      <if test="key != null">
+        #{key,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="value != null">
+        #{value,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AppConfig">
+    update app_config
+    <set>
+      <if test="cate != null">
+        `cate` = #{cate,jdbcType=VARCHAR},
+      </if>
+      <if test="key != null">
+        `key` = #{key,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="value != null">
+        `value` = #{value,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AppConfig">
+    update app_config
+    set `cate` = #{cate,jdbcType=VARCHAR},
+      `key` = #{key,jdbcType=VARCHAR},
+      `name` = #{name,jdbcType=VARCHAR},
+      `value` = #{value,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <select id="findList" resultType="com.alibaba.fastjson.JSONObject">
+    select 
+    <include refid="Base_Column_List" />
+    from app_config
+  </select>
+</mapper>

+ 36 - 0
src/main/java/com/goafanti/common/mapper/MyAppMapper.xml

@@ -0,0 +1,36 @@
+<?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.MyAppMapper">
+  <select id="countCollections" parameterType="String" resultType="org.springframework.ui.ModelMap">
+  	select 
+	(select count(1) from achievement_interest ai where ai.uid=#{uid,jdbcType=VARCHAR}) as achievement,
+	(select count(1) from demand_interest di where di.uid=#{uid,jdbcType=VARCHAR}) as demand,
+	(SELECT count(1) FROM user_interest uin left join user u on uin.to_uid=u.id where u.type=0 and uin.from_uid=#{uid,jdbcType=VARCHAR}) as expert,
+	(SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='企业' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as company,
+	(SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='院校' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as school,
+	(SELECT count(1) FROM user_interest uin left join organization_info oi on uin.to_uid=oi.uid where oi.identity_type='研究机构' and uin.from_uid=#{uid,jdbcType=VARCHAR}) as institute
+  </select>
+  <select id="countOrders" parameterType="String" resultType="org.springframework.ui.ModelMap">
+  	select 
+	(select count(1) from org_cognizance where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as hightech,
+	(select count(1) from tech_project where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as program,
+	(SELECT count(1) FROM patent_info where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as patent,
+	(SELECT count(1) FROM value_evaluation where uid=#{uid,jdbcType=VARCHAR}) as evalution,
+	(SELECT count(1) FROM activity_user where uid=#{uid,jdbcType=VARCHAR}) as activity,
+	(SELECT count(1) FROM achievement_order where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as achievement,
+	(SELECT count(1) FROM demand_order where uid=#{uid,jdbcType=VARCHAR} and deleted_sign=0) as demand,
+	(SELECT count(1) FROM copyright_info where uid=#{uid,jdbcType=VARCHAR} and delete_sign=0) as copyright
+  </select>
+  <select id="countMyTech" parameterType="String" resultType="org.springframework.ui.ModelMap">
+  	select 
+	(select count(1) from achievement a left join achievement_demand ad on a.id=ad.achievement_id where a.owner_id=#{uid,jdbcType=VARCHAR}) as `match`,
+	(select count(1) from achievement a left join achievement_order ao on a.id=ao.achievement_id where a.owner_id=#{uid,jdbcType=VARCHAR} and ao.status>5 and (ao.service_money>0 or ao.commission>0 or ao.intention_money>0)) as `deal`,
+	(select count(1) from achievement a left join achievement_interest ai on a.id=ai.achievement_id where a.owner_id=#{uid,jdbcType=VARCHAR}) as `intention`
+  </select>
+  <select id="countMyDemand" parameterType="String" resultType="org.springframework.ui.ModelMap">
+	select 
+	(select count(1) from demand d left join achievement_demand ad on d.id=ad.demand_id where d.employer_id=#{uid,jdbcType=VARCHAR}) as `match`,
+	(select count(1) from demand d left join demand_order `do` on d.id=`do`.demand_id where d.employer_id=#{uid,jdbcType=VARCHAR} and `do`.status>5 and (`do`.service_money>0 or `do`.commission>0 or `do`.intention_money>0)) as `deal`,
+	(select count(1) from demand d left join demand_interest di on d.id=di.demand_id where d.employer_id=#{uid,jdbcType=VARCHAR}) as `intention`
+  </select>
+</mapper>

+ 66 - 0
src/main/java/com/goafanti/common/model/AppConfig.java

@@ -0,0 +1,66 @@
+package com.goafanti.common.model;
+
+public class AppConfig {
+	private Integer	id;
+
+	/**
+	 * 分类
+	 */
+	private String	cate;
+
+	/**
+	 * 关键字
+	 */
+	private String	key;
+
+	/**
+	 * 名称
+	 */
+	private String	name;
+
+	/**
+	 * 值
+	 */
+	private String	value;
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public String getCate() {
+		return cate;
+	}
+
+	public void setCate(String cate) {
+		this.cate = cate;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+}

+ 3 - 3
src/main/webapp/WEB-INF/views/portal/detail/achievementDetail.html

@@ -103,10 +103,10 @@
 			</div>
 		</div>
 	</div>
-	<div class="container introduce details">
+	<!-- <div class="container introduce details">
 		<h2>专利详情:</h2>
 		<p th:text="${achievement.patentCase}"></p>
-	</div>
+	</div> -->
 	<div class="container introduce">
 		<h2>技术简介:</h2>
 		<p th:text="${achievement.introduction}"></p>
@@ -130,7 +130,7 @@
 						</div>
 						<div class="form-group">
 							<label class="col-sm-5 control-label">所 在 地 :</label>
-							<div class="col-sm-7" th:text="${similar.location}"></div>
+							<div class="col-sm-7" th:title="${similar.location}" th:text="${similar.location}"></div>
 						</div>
 						<div class="form-group">
 							<label class="col-sm-5 control-label">技术成熟度 :</label>

+ 2 - 2
src/main/webapp/WEB-INF/views/portal/ipr/apply.html

@@ -73,13 +73,13 @@
 					</div></li>
 				<li><img th:src="${portalHost + '/img/ipr_img_3.png'}" />
 					<div class="apply_modal">
-						<h1>外观专利</h1>
+						<h1>商标权</h1>
 						<a
 							th:href="${basePath + '/user/account/services.html#contract'}">我要申请</a>
 					</div></li>
 				<li><img th:src="${portalHost + '/img/ipr_img_4.png'}" />
 					<div class="apply_modal">
-						<h1>软件著作权</h1>
+						<h1>著作权</h1>
 						<a th:href="${basePath + '/user/account/services.html#contract'}">我要申请</a>
 					</div></li>
 			</ul>

+ 1 - 1
src/main/webapp/WEB-INF/views/portal/ipr/patentOperation.html

@@ -83,7 +83,7 @@
 		<div class="content">
 			<div class="content_nav">
 				<ul id="myTab">
-					<li class="active"><a href="#tab1" data-toggle="tab"> <span>专利技术分析</span>
+					<li class="active"><a href="#tab1" data-toggle="tab"> <span>专利情报分析</span>
 					</a> <img
 						src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALBAMAAACEzBAKAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAPUExURXy4/0dwTObx/6zS//D3/3zk8F4AAAACdFJOU38A3jSoAQAAAD5JREFUCNc9yIEJACAMA8GIC7Qz6ADiCJL9ZzJRsZDyHDIzih60Om7EbOVE7Ws4YpIiCEgRDCYYTDggAt/92AlDDjfH3KJAAAAAAElFTkSuQmCC" />
 					</li>