Browse Source

知识产权信息录入接口

Antiloveg 9 years ago
parent
commit
5daf211a55

+ 29 - 0
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.admin.controller;
 
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.UUID;
 
 import javax.annotation.Resource;
@@ -13,11 +14,14 @@ import org.springframework.web.bind.annotation.RequestParam;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.OrgHumanResource;
+import com.goafanti.common.model.OrgIntellectualProperty;
 import com.goafanti.common.model.OrgStandard;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.UserIdentity;
+import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.techservice.cognizance.service.OrgIntellectualPropertyService;
 import com.goafanti.techservice.cognizance.service.OrgStandardService;
 import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.UserListBo;
@@ -39,6 +43,8 @@ public class AdminApiController extends BaseApiController {
 	private OrgHumanResourceService		orgHumanResourceService;
 	@Resource
 	private OrgStandardService	orgStandardService;
+	@Resource
+	private OrgIntellectualPropertyService orgIntellectualPropertyService;
 
 	/**
 	 * 个人用户列表
@@ -220,6 +226,9 @@ public class AdminApiController extends BaseApiController {
 		Result res = new Result();
 		if (StringUtils.isBlank(orgStandard.getId())){
 			orgStandard.setId(UUID.randomUUID().toString());
+			Calendar now = Calendar.getInstance();
+			now.set(Calendar.MILLISECOND, 0);
+			orgStandard.setCreateTime(now.getTime());
 			orgStandardService.insert(orgStandard);
 		} else {
 			orgStandardService.updateByPrimaryKeySelective(orgStandard);
@@ -228,6 +237,26 @@ public class AdminApiController extends BaseApiController {
 		return res;
 	}
 	
+	/**
+	 * 管理端录入知识产权信息
+	 * @return
+	 */
+	@RequestMapping(value="/intellectual", method = RequestMethod.POST)
+	public Result intellectual(OrgIntellectualProperty orgIntellectualProperty, String authorizationDate, String uid){
+		Result res = new Result();
+		try {
+			orgIntellectualProperty.setId(UUID.randomUUID().toString());
+			orgIntellectualProperty.setUid(uid);
+			orgIntellectualProperty.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
+			orgIntellectualProperty.setAuthorizationDate(DateUtils.parseDate(authorizationDate, "yyyy-MM-dd"));
+		} catch (ParseException e) {
+		    res.getError().add(buildError("", "日期格式不正确"));
+		    return res;
+		}
+		res.setData(orgIntellectualPropertyService.insert(orgIntellectualProperty));
+		return res;
+	}
+	
 	
 
 	// org团体列表

+ 17 - 0
src/main/java/com/goafanti/common/dao/OrgIntellectualPropertyMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.OrgIntellectualProperty;
+
+public interface OrgIntellectualPropertyMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(OrgIntellectualProperty record);
+
+    int insertSelective(OrgIntellectualProperty record);
+
+    OrgIntellectualProperty selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(OrgIntellectualProperty record);
+
+    int updateByPrimaryKey(OrgIntellectualProperty record);
+}

+ 153 - 0
src/main/java/com/goafanti/common/mapper/OrgIntellectualPropertyMapper.xml

@@ -0,0 +1,153 @@
+<?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.OrgIntellectualPropertyMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrgIntellectualProperty" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="uid" property="uid" jdbcType="VARCHAR" />
+    <result column="intellectual_property_number" property="intellectualPropertyNumber" jdbcType="VARCHAR" />
+    <result column="intellectual_property_name" property="intellectualPropertyName" jdbcType="VARCHAR" />
+    <result column="sort_number" property="sortNumber" jdbcType="VARCHAR" />
+    <result column="catagory" property="catagory" jdbcType="INTEGER" />
+    <result column="obtain_way" property="obtainWay" jdbcType="INTEGER" />
+    <result column="authorization_number" property="authorizationNumber" jdbcType="VARCHAR" />
+    <result column="authorization_date" property="authorizationDate" jdbcType="TIMESTAMP" />
+    <result column="evaluation_category" property="evaluationCategory" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, uid, intellectual_property_number, intellectual_property_name, sort_number, catagory, 
+    obtain_way, authorization_number, authorization_date, evaluation_category
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from org_intellectual_property
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from org_intellectual_property
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
+    insert into org_intellectual_property (id, uid, intellectual_property_number, 
+      intellectual_property_name, sort_number, catagory, 
+      obtain_way, authorization_number, authorization_date, 
+      evaluation_category)
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{intellectualPropertyNumber,jdbcType=VARCHAR}, 
+      #{intellectualPropertyName,jdbcType=VARCHAR}, #{sortNumber,jdbcType=VARCHAR}, #{catagory,jdbcType=INTEGER}, 
+      #{obtainWay,jdbcType=INTEGER}, #{authorizationNumber,jdbcType=VARCHAR}, #{authorizationDate,jdbcType=TIMESTAMP}, 
+      #{evaluationCategory,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
+    insert into org_intellectual_property
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="uid != null" >
+        uid,
+      </if>
+      <if test="intellectualPropertyNumber != null" >
+        intellectual_property_number,
+      </if>
+      <if test="intellectualPropertyName != null" >
+        intellectual_property_name,
+      </if>
+      <if test="sortNumber != null" >
+        sort_number,
+      </if>
+      <if test="catagory != null" >
+        catagory,
+      </if>
+      <if test="obtainWay != null" >
+        obtain_way,
+      </if>
+      <if test="authorizationNumber != null" >
+        authorization_number,
+      </if>
+      <if test="authorizationDate != null" >
+        authorization_date,
+      </if>
+      <if test="evaluationCategory != null" >
+        evaluation_category,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="uid != null" >
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="intellectualPropertyNumber != null" >
+        #{intellectualPropertyNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="intellectualPropertyName != null" >
+        #{intellectualPropertyName,jdbcType=VARCHAR},
+      </if>
+      <if test="sortNumber != null" >
+        #{sortNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="catagory != null" >
+        #{catagory,jdbcType=INTEGER},
+      </if>
+      <if test="obtainWay != null" >
+        #{obtainWay,jdbcType=INTEGER},
+      </if>
+      <if test="authorizationNumber != null" >
+        #{authorizationNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="authorizationDate != null" >
+        #{authorizationDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="evaluationCategory != null" >
+        #{evaluationCategory,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
+    update org_intellectual_property
+    <set >
+      <if test="uid != null" >
+        uid = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="intellectualPropertyNumber != null" >
+        intellectual_property_number = #{intellectualPropertyNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="intellectualPropertyName != null" >
+        intellectual_property_name = #{intellectualPropertyName,jdbcType=VARCHAR},
+      </if>
+      <if test="sortNumber != null" >
+        sort_number = #{sortNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="catagory != null" >
+        catagory = #{catagory,jdbcType=INTEGER},
+      </if>
+      <if test="obtainWay != null" >
+        obtain_way = #{obtainWay,jdbcType=INTEGER},
+      </if>
+      <if test="authorizationNumber != null" >
+        authorization_number = #{authorizationNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="authorizationDate != null" >
+        authorization_date = #{authorizationDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="evaluationCategory != null" >
+        evaluation_category = #{evaluationCategory,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
+    update org_intellectual_property
+    set uid = #{uid,jdbcType=VARCHAR},
+      intellectual_property_number = #{intellectualPropertyNumber,jdbcType=VARCHAR},
+      intellectual_property_name = #{intellectualPropertyName,jdbcType=VARCHAR},
+      sort_number = #{sortNumber,jdbcType=VARCHAR},
+      catagory = #{catagory,jdbcType=INTEGER},
+      obtain_way = #{obtainWay,jdbcType=INTEGER},
+      authorization_number = #{authorizationNumber,jdbcType=VARCHAR},
+      authorization_date = #{authorizationDate,jdbcType=TIMESTAMP},
+      evaluation_category = #{evaluationCategory,jdbcType=INTEGER}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+</mapper>

+ 143 - 0
src/main/java/com/goafanti/common/model/OrgIntellectualProperty.java

@@ -0,0 +1,143 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+public class OrgIntellectualProperty {
+    private String id;
+
+    private String uid;
+
+    /**
+    * 知识产权编号
+    */
+    private String intellectualPropertyNumber;
+
+    /**
+    * 知识产权名称
+    */
+    private String intellectualPropertyName;
+
+    /**
+    * 排序号
+    */
+    private String sortNumber;
+
+    /**
+    * 类别
+    */
+    private Integer catagory;
+
+    /**
+    * 获得方式
+    */
+    private Integer obtainWay;
+
+    /**
+    * 授权号
+    */
+    private String authorizationNumber;
+
+    /**
+    * 授权日期
+    */
+    private Date authorizationDate;
+
+    /**
+    * 0--Ⅰ类, 1--Ⅱ类
+    */
+    private Integer evaluationCategory;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getIntellectualPropertyNumber() {
+        return intellectualPropertyNumber;
+    }
+
+    public void setIntellectualPropertyNumber(String intellectualPropertyNumber) {
+        this.intellectualPropertyNumber = intellectualPropertyNumber;
+    }
+
+    public String getIntellectualPropertyName() {
+        return intellectualPropertyName;
+    }
+
+    public void setIntellectualPropertyName(String intellectualPropertyName) {
+        this.intellectualPropertyName = intellectualPropertyName;
+    }
+
+    public String getSortNumber() {
+        return sortNumber;
+    }
+
+    public void setSortNumber(String sortNumber) {
+        this.sortNumber = sortNumber;
+    }
+
+    public Integer getCatagory() {
+        return catagory;
+    }
+
+    public void setCatagory(Integer catagory) {
+        this.catagory = catagory;
+    }
+
+    public Integer getObtainWay() {
+        return obtainWay;
+    }
+
+    public void setObtainWay(Integer obtainWay) {
+        this.obtainWay = obtainWay;
+    }
+
+    public String getAuthorizationNumber() {
+        return authorizationNumber;
+    }
+
+    public void setAuthorizationNumber(String authorizationNumber) {
+        this.authorizationNumber = authorizationNumber;
+    }
+
+    public Date getAuthorizationDate() {
+        return authorizationDate;
+    }
+
+    public void setAuthorizationDate(Date authorizationDate) {
+        this.authorizationDate = authorizationDate;
+    }
+
+    public Integer getEvaluationCategory() {
+        return evaluationCategory;
+    }
+
+    public void setEvaluationCategory(Integer evaluationCategory) {
+        this.evaluationCategory = evaluationCategory;
+    }
+    
+    public String getAuthorizationDateFormattedDate(){
+		if (this.authorizationDate == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getAuthorizationDate(), "yyyy-MM-dd");
+		}
+	}
+	
+	public void setAuthorizationDateFormattedDate(String authorizationDateFormattedDate){
+		
+	}
+}

+ 28 - 0
src/main/java/com/goafanti/techservice/cognizance/controller/CognizanceApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.techservice.cognizance.controller;
 
 import java.text.ParseException;
+import java.util.Calendar;
 import java.util.UUID;
 
 import javax.annotation.Resource;
@@ -12,11 +13,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.OrgActivity;
+import com.goafanti.common.model.OrgIntellectualProperty;
 import com.goafanti.common.model.OrgStandard;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.techservice.cognizance.service.OrgActivityService;
+import com.goafanti.techservice.cognizance.service.OrgIntellectualPropertyService;
 import com.goafanti.techservice.cognizance.service.OrgStandardService;
 import com.goafanti.user.service.UserService;
 
@@ -29,6 +32,8 @@ public class CognizanceApiController extends BaseApiController {
 	private OrgStandardService	orgStandardService;
 	@Resource
 	private OrgActivityService  orgActivityService;
+	@Resource
+	private OrgIntellectualPropertyService orgIntellectualPropertyService;
     
 	/**
 	 * 企业研究开发活动情况表及企业年度研究开发费用结构明细表入口
@@ -113,6 +118,9 @@ public class CognizanceApiController extends BaseApiController {
 		if (StringUtils.isBlank(orgStandard.getId())) {
 			orgStandard.setId(UUID.randomUUID().toString());
 			orgStandard.setUid(TokenManager.getUserId());
+			Calendar now = Calendar.getInstance();
+			now.set(Calendar.MILLISECOND, 0);
+			orgStandard.setCreateTime(now.getTime());
 			orgStandardService.insert(orgStandard);
 		} else {
 			orgStandardService.updateByPrimaryKeySelective(orgStandard);
@@ -132,4 +140,24 @@ public class CognizanceApiController extends BaseApiController {
 		res.setData(orgStandardService.delete(id));
 		return res;
 	}
+	
+	/**
+	 * 用户端录入知识产权信息(专利+软著)
+	 * @return
+	 */
+	@RequestMapping(value="/intellectual", method = RequestMethod.POST)
+	public Result intellectual(OrgIntellectualProperty orgIntellectualProperty, String authorizationDateFormattedDate){
+		Result res = new Result();
+		try {
+			orgIntellectualProperty.setId(UUID.randomUUID().toString());
+			orgIntellectualProperty.setUid(TokenManager.getUserId());
+			orgIntellectualProperty.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
+			orgIntellectualProperty.setAuthorizationDate(DateUtils.parseDate(authorizationDateFormattedDate, "yyyy-MM-dd"));
+		} catch (ParseException e) {
+		    res.getError().add(buildError("", "日期格式不正确"));
+		    return res;
+		}
+		res.setData(orgIntellectualPropertyService.insert(orgIntellectualProperty));
+		return res;
+	}
 }

+ 9 - 0
src/main/java/com/goafanti/techservice/cognizance/service/OrgIntellectualPropertyService.java

@@ -0,0 +1,9 @@
+package com.goafanti.techservice.cognizance.service;
+
+import com.goafanti.common.model.OrgIntellectualProperty;
+
+public interface OrgIntellectualPropertyService {
+
+	OrgIntellectualProperty insert(OrgIntellectualProperty orgIntellectualProperty);
+
+}

+ 20 - 0
src/main/java/com/goafanti/techservice/cognizance/service/impl/OrgIntellectualPropertyServiceImpl.java

@@ -0,0 +1,20 @@
+package com.goafanti.techservice.cognizance.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
+import com.goafanti.common.model.OrgIntellectualProperty;
+import com.goafanti.techservice.cognizance.service.OrgIntellectualPropertyService;
+@Service
+public class OrgIntellectualPropertyServiceImpl implements OrgIntellectualPropertyService {
+	@Autowired
+	private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
+	
+	@Override
+	public OrgIntellectualProperty insert(OrgIntellectualProperty orgIntellectualProperty) {
+		orgIntellectualPropertyMapper.insert(orgIntellectualProperty);
+		return orgIntellectualProperty;
+	}
+
+}

+ 11 - 55
src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java

@@ -90,6 +90,9 @@ public class PatentApiController extends BaseApiController {
 		Result res = new Result();
 		patentInfo.setId(UUID.randomUUID().toString());
 		patentInfo.setUid(TokenManager.getUserId());
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		patentInfo.setCreateTime(now.getTime());
 		patentInfoService.insert(patentInfo);
 		PatentRegistration patentRegistration = new PatentRegistration();
 		patentRegistration.setId(UUID.randomUUID().toString());
@@ -136,59 +139,9 @@ public class PatentApiController extends BaseApiController {
 		return res;
 	}
 	
-	/**
-	 * 用户端录入知识产权信息(专利)
-	 * @return
-	 */
-	@RequestMapping(value="/clientInputPatent", method = RequestMethod.POST)
-	public Result clientInputPatent(String patentNumber, String patentName, Integer patentCatagory, Integer obtailWay,
-			Integer sortNumber,String authorizationNumber, String authorizationDate){
-		Result res = new Result();
-		PatentInfo patent = new PatentInfo();
-		patent.setId(UUID.randomUUID().toString());
-		patent.setUid(TokenManager.getUserId());
-		patent.setPatentName(patentName);
-		patent.setPatentNumber(patentNumber);;
-		patent.setPatentCatagory(patentCatagory);
-		try {
-			patent.setAuthorizedDate(DateUtils.parseDate(authorizationDate, "yyyy-MM-dd"));
-		} catch (ParseException e) {
-		    res.getError().add(buildError("", "日期格式不正确"));
-		}
-		res.setData(patentInfoService.insert(patent));
-		return res;
-	}
 	
-	/**
-	 * 管理端录入知识产权信息(专利)
-	 * @param patentNumber
-	 * @param patentName
-	 * @param patentCatagory
-	 * @param obtailWay
-	 * @param sortNumber
-	 * @param authorizationNumber
-	 * @param authorizationDate
-	 * @param uid
-	 * @return
-	 */
-	@RequestMapping(value="/managerInputPatent", method = RequestMethod.POST)
-	public Result managerInputPatent(String patentNumber, String patentName, Integer patentCatagory, Integer obtailWay,
-			Integer sortNumber,String authorizationNumber, String authorizationDate, String uid){
-		Result res = new Result();
-		PatentInfo patent = new PatentInfo();
-		patent.setId(UUID.randomUUID().toString());
-		patent.setUid(uid);
-		patent.setPatentName(patentName);
-		patent.setPatentNumber(patentNumber);;
-		patent.setPatentCatagory(patentCatagory);
-		try {
-			patent.setAuthorizedDate(DateUtils.parseDate(authorizationDate, "yyyy-MM-dd"));
-		} catch (ParseException e) {
-		    res.getError().add(buildError("", "日期格式不正确"));
-		}
-		res.setData(patentInfoService.insert(patent));
-		return res;
-	}
+	
+	
 	
 	
 
@@ -270,6 +223,9 @@ public class PatentApiController extends BaseApiController {
 		}
 		patentInfo.setId(UUID.randomUUID().toString());
 		patentInfo.setUid(uid);
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		patentInfo.setCreateTime(now.getTime());
 		patentInfoService.insert(patentInfo);
 		PatentRegistration patentRegistration = new PatentRegistration();
 		patentRegistration.setId(UUID.randomUUID().toString());
@@ -296,8 +252,8 @@ public class PatentApiController extends BaseApiController {
 		PatentInfo patentInfo = new PatentInfo();
 		patentInfo.setId(xid);
 		patentInfo.setPatentNumber(patentNumber);
-		patentInfo.setPatentCatagory(StringUtils.isNumeric(patentCatagory)?Integer.parseInt(patentCatagory):null);
-		patentInfo.setPatentField(StringUtils.isNumeric(patentField)?Integer.parseInt(patentField):null);;
+		patentInfo.setPatentCatagory(StringUtils.isNumeric(patentCatagory)? Integer.parseInt(patentCatagory) : null);
+		patentInfo.setPatentField(StringUtils.isNumeric(patentField)? Integer.parseInt(patentField) : null);;
 		patentInfo.setPatentDes(patentDes);
 		patentInfo.setPatentWritingUrl(patentWritingUrl);
 		patentInfo.setAuthorizationNoticeUrl(authorizationNoticeUrl);
@@ -985,7 +941,7 @@ public class PatentApiController extends BaseApiController {
 	private String switchPatState(Integer s){
 		String state = "";
 		switch  (s){
-		case 0:
+		case 11:
 			state = "撤销";
 			break;
 		case 1: