Browse Source

FileUtils

Antiloveg 8 years ago
parent
commit
a13f9b2d33
23 changed files with 650 additions and 161 deletions
  1. 0 10
      src/main/java/com/goafanti/common/controller/PublicController.java
  2. 14 3
      src/main/java/com/goafanti/common/mapper/OrgActivityCostMapper.xml
  3. 15 4
      src/main/java/com/goafanti/common/mapper/OrgActivityMapper.xml
  4. 14 3
      src/main/java/com/goafanti/common/mapper/OrgHonorDatumMapper.xml
  5. 29 5
      src/main/java/com/goafanti/common/mapper/OrgTechCenterMapper.xml
  6. 14 3
      src/main/java/com/goafanti/common/mapper/OrgTechProductMapper.xml
  7. 14 1
      src/main/java/com/goafanti/common/model/OrgActivity.java
  8. 15 1
      src/main/java/com/goafanti/common/model/OrgActivityCost.java
  9. 18 2
      src/main/java/com/goafanti/common/model/OrgFinance.java
  10. 29 1
      src/main/java/com/goafanti/common/model/OrgHonorDatum.java
  11. 26 1
      src/main/java/com/goafanti/common/model/OrgHumanResource.java
  12. 15 0
      src/main/java/com/goafanti/common/model/OrgRatepay.java
  13. 16 0
      src/main/java/com/goafanti/common/model/OrgTechAchievement.java
  14. 43 2
      src/main/java/com/goafanti/common/model/OrgTechCenter.java
  15. 15 0
      src/main/java/com/goafanti/common/model/OrgTechCenterDetail.java
  16. 13 0
      src/main/java/com/goafanti/common/model/OrgTechProduct.java
  17. 54 0
      src/main/java/com/goafanti/common/model/PatentInfo.java
  18. 0 64
      src/main/java/com/goafanti/common/utils/DownloadUtils.java
  19. 220 0
      src/main/java/com/goafanti/common/utils/FileUtils.java
  20. 4 8
      src/main/java/com/goafanti/techservice/cognizance/controller/CognizanceApiController.java
  21. 55 0
      src/main/java/com/goafanti/techservice/patent/bo/PatentCompositeBo.java
  22. 23 32
      src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java
  23. 4 21
      src/main/java/com/goafanti/user/controller/UserApiController.java

+ 0 - 10
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -181,16 +181,6 @@ public class PublicController extends BaseController {
 		OutputStream out = null;
 		byte[] buffer = new byte[8 * 1024];
 		String fileSaveRootPath = "";
-		//下载权限判断
-		/*if(null == TokenManager.getAdminToken()){
-			UserDownLoadBo u = userService.selectUserDownLoadBoByUserId(TokenManager.getUserId());
-			if(!path.equals(u.getDegreeDiplomaUrl())&&!path.equals(u.getDiplomaUrl())&&
-			   !path.equals(u.getOppositeIdUrl())&&!path.equals(u.getPositiveIdUrl())&&
-			   !path.equals(u.getProfessionalCertificateUrl())&&!path.equals(u.getQualificationCertificateUrl())){
-				res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "权限不足,无法下载!"));	
-				return res;
-			}
-		}*/
 		try {
 				fileSaveRootPath = uploadPrivatePath + path;
 				File file = new File(fileSaveRootPath);

+ 14 - 3
src/main/java/com/goafanti/common/mapper/OrgActivityCostMapper.xml

@@ -20,13 +20,14 @@
     <result column="sort_number" property="sortNumber" jdbcType="VARCHAR" />
     <result column="start_date" property="startDate" jdbcType="TIMESTAMP" />
     <result column="end_date" property="endDate" jdbcType="TIMESTAMP" />
+    <result column="account_url" property="accountUrl" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
     id, aid, uid, activity_number, internal_labor_cost, internal_direct_cost, internal_depreciation_cost, 
     internal_amortization_cost, internal_design_cost, internal_equipment_cost, internal_other_cost, 
     external_total_cost, external_abroad_cost, enterprise_filler, sign_date, sort_number, 
-    start_date, end_date, deleted_sign
+    start_date, end_date, account_url, deleted_sign
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -45,7 +46,7 @@
       internal_design_cost, internal_equipment_cost, 
       internal_other_cost, external_total_cost, external_abroad_cost, 
       enterprise_filler, sign_date, sort_number, 
-      start_date, end_date, deleted_sign
+      start_date, end_date, account_url, deleted_sign
       )
     values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, 
       #{activityNumber,jdbcType=VARCHAR}, #{internalLaborCost,jdbcType=INTEGER}, #{internalDirectCost,jdbcType=INTEGER}, 
@@ -53,7 +54,7 @@
       #{internalDesignCost,jdbcType=INTEGER}, #{internalEquipmentCost,jdbcType=INTEGER}, 
       #{internalOtherCost,jdbcType=INTEGER}, #{externalTotalCost,jdbcType=INTEGER}, #{externalAbroadCost,jdbcType=INTEGER}, 
       #{enterpriseFiller,jdbcType=VARCHAR}, #{signDate,jdbcType=TIMESTAMP}, #{sortNumber,jdbcType=VARCHAR}, 
-      #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}, #{deletedSign,jdbcType=INTEGER}
+      #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}, #{accountUrl,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgActivityCost" >
@@ -113,6 +114,9 @@
       <if test="endDate != null" >
         end_date,
       </if>
+       <if test="accountUrl != null" >
+        account_url,
+      </if>
       <if test="deletedSign != null" >
         deleted_sign,
       </if>
@@ -172,6 +176,9 @@
       <if test="endDate != null" >
         #{endDate,jdbcType=TIMESTAMP},
       </if>
+      <if test="accountUrl != null" >
+        #{accountUrl,jdbcType=VARCHAR},
+      </if>
       <if test="deletedSign != null" >
         #{deletedSign,jdbcType=INTEGER},
       </if>
@@ -231,6 +238,9 @@
       <if test="endDate != null" >
         end_date = #{endDate,jdbcType=TIMESTAMP},
       </if>
+      <if test="accountUrl != null" >
+        accoun_url = #{accountUrl,jdbcType=VACHAR},
+      </if>
       <if test="deletedSign != null" >
         deleted_sign = #{deletedSign,jdbcType=INTEGER},
       </if>
@@ -256,6 +266,7 @@
       sort_number = #{sortNumber,jdbcType=VARCHAR},
       start_date = #{startDate,jdbcType=TIMESTAMP},
       end_date = #{endDate,jdbcType=TIMESTAMP},
+      account_url = #{accountUrl,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>

+ 15 - 4
src/main/java/com/goafanti/common/mapper/OrgActivityMapper.xml

@@ -9,6 +9,7 @@
     <result column="start_date" property="startDate" jdbcType="TIMESTAMP" />
     <result column="end_date" property="endDate" jdbcType="TIMESTAMP" />
     <result column="participant" property="participant" jdbcType="VARCHAR" />
+    <result column="project_mode" property="projectMode" jdbcType="INTEGER" />
     <result column="technical_field1" property="technicalField1" jdbcType="VARCHAR" />
     <result column="technical_field2" property="technicalField2" jdbcType="VARCHAR" />
     <result column="technical_field3" property="technicalField3" jdbcType="VARCHAR" />
@@ -25,8 +26,8 @@
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, uid, activity_number, activity_name, start_date, end_date, participant, technical_field1, 
-    technical_field2, technical_field3, technical_source, intellectual_property_number, 
+    id, uid, activity_number, activity_name, start_date, end_date, participant, project_mode,
+    technical_field1,  technical_field2, technical_field3, technical_source, intellectual_property_number, 
     budget, first_year_expenditure, second_year_expenditure, third_year_expenditure, 
     implement, technology_innovation, achievement, proof_url, deleted_sign
   </sql>
@@ -42,7 +43,7 @@
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.OrgActivity" >
     insert into org_activity (id, uid, activity_number, 
-      activity_name, start_date, end_date, participant,
+      activity_name, start_date, end_date, participant, project_mode,
       technical_field1, technical_field2, technical_field3, 
       technical_source, intellectual_property_number, 
       budget, first_year_expenditure, second_year_expenditure, 
@@ -51,7 +52,7 @@
       )
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{activityNumber,jdbcType=VARCHAR}, 
       #{activityName,jdbcType=VARCHAR}, #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}, #{participant,jdbcType=VARCHAR},
-      #{technicalField1,jdbcType=VARCHAR}, #{technicalField2,jdbcType=VARCHAR}, #{technicalField3,jdbcType=VARCHAR}, 
+      #{projectMode,jdbcType=INTEGER}, #{technicalField1,jdbcType=VARCHAR}, #{technicalField2,jdbcType=VARCHAR}, #{technicalField3,jdbcType=VARCHAR}, 
       #{technicalSource,jdbcType=INTEGER}, #{intellectualPropertyNumber,jdbcType=VARCHAR}, 
       #{budget,jdbcType=INTEGER}, #{firstYearExpenditure,jdbcType=INTEGER}, #{secondYearExpenditure,jdbcType=INTEGER}, 
       #{thirdYearExpenditure,jdbcType=INTEGER}, #{implement,jdbcType=VARCHAR}, #{technologyInnovation,jdbcType=VARCHAR}, 
@@ -82,6 +83,9 @@
       <if test="participant != null" >
         participant,
       </if>
+       <if test="projectMode != null" >
+        project_mode,
+      </if>
       <if test="technicalField1 != null" >
         technical_field1,
       </if>
@@ -147,6 +151,9 @@
        <if test="participant != null" >
         #{participant,jdbcType=VARCHAR},
       </if>
+       <if test="projectMode != null" >
+        #{projectMode,jdbcType=INTEGER},
+      </if>
       <if test="technicalField1 != null" >
         #{technicalField1,jdbcType=VARCHAR},
       </if>
@@ -212,6 +219,9 @@
       <if test="participant != null" >
         participant = #{participant,jdbcType=VARCHAR},
       </if>
+      <if test="projectMode != null" >
+        project_mode = #{projectMode,jdbcType=INTEGER},
+      </if>
       <if test="technicalField1 != null" >
         technical_field1 = #{technicalField1,jdbcType=VARCHAR},
       </if>
@@ -265,6 +275,7 @@
       start_date = #{startDate,jdbcType=TIMESTAMP},
       end_date = #{endDate,jdbcType=TIMESTAMP},
       participant = #{participant,jdbcType=VARCHAR},
+      project_mode = #{projectMode,jdbcType=INTEGER},
       technical_field1 = #{technicalField1,jdbcType=VARCHAR},
       technical_field2 = #{technicalField2,jdbcType=VARCHAR},
       technical_field3 = #{technicalField3,jdbcType=VARCHAR},

+ 14 - 3
src/main/java/com/goafanti/common/mapper/OrgHonorDatumMapper.xml

@@ -5,12 +5,13 @@
     <id column="id" property="id" jdbcType="VARCHAR" />
     <result column="uid" property="uid" jdbcType="VARCHAR" />
     <result column="name" property="name" jdbcType="VARCHAR" />
+    <result column="issuing_mechanism" property="issuingMechanism" jdbcType="VARCHAR" />
     <result column="issuing_time" property="issuingTime" jdbcType="TIMESTAMP" />
     <result column="enclosure_url" property="enclosureUrl" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, uid, name, issuing_time, enclosure_url, deleted_sign
+    id, uid, name, issuing_mechanism, issuing_time, enclosure_url, deleted_sign
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -23,10 +24,10 @@
     where id = #{id,jdbcType=VARCHAR}
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.OrgHonorDatum" >
-    insert into org_honor_datum (id, uid, name, 
+    insert into org_honor_datum (id, uid, name, issuing_mechanism,
       issuing_time, enclosure_url, deleted_sign
       )
-    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{issuingMechanism, jdbcType=VARCHAR},
       #{issuingTime,jdbcType=TIMESTAMP}, #{enclosureUrl,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}
       )
   </insert>
@@ -42,6 +43,9 @@
       <if test="name != null" >
         name,
       </if>
+      <if test="issuing_mechanism != null">
+      	issuing_mechanism,
+      </if>
       <if test="issuingTime != null" >
         issuing_time,
       </if>
@@ -62,6 +66,9 @@
       <if test="name != null" >
         #{name,jdbcType=VARCHAR},
       </if>
+      <if test="issuingMechanism != null">
+      	#{issuingMechanism,jdbcType=VARCHAR},
+      </if>
       <if test="issuingTime != null" >
         #{issuingTime,jdbcType=TIMESTAMP},
       </if>
@@ -82,6 +89,9 @@
       <if test="name != null" >
         name = #{name,jdbcType=VARCHAR},
       </if>
+      <if test="issuingMechanism != null">
+      	issuing_mechanism = #{issuingMechanism,jdbcType=VARCHAR},
+      </if>
       <if test="issuingTime != null" >
         issuing_time = #{issuingTime,jdbcType=TIMESTAMP},
       </if>
@@ -98,6 +108,7 @@
     update org_honor_datum
     set uid = #{uid,jdbcType=VARCHAR},
       name = #{name,jdbcType=VARCHAR},
+      issuingMechanism = #{issuingMechanism,jdbcType=VARCHAR},
       issuing_time = #{issuingTime,jdbcType=TIMESTAMP},
       enclosure_url = #{enclosureUrl,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER}

+ 29 - 5
src/main/java/com/goafanti/common/mapper/OrgTechCenterMapper.xml

@@ -4,8 +4,10 @@
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrgTechCenter" >
     <id column="id" property="id" jdbcType="VARCHAR" />
     <result column="uid" property="uid" jdbcType="VARCHAR" />
+    <result column="center_name" property="centerName" jdbcType="VARCHAR" />
     <result column="founding_time" property="foundingTime" jdbcType="TIMESTAMP" />
     <result column="principal" property="principal" jdbcType="VARCHAR" />
+    <result column="comment" property="comment" jdbcType="VARCHAR" />
     <result column="system_url" property="systemUrl" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
   </resultMap>
@@ -13,7 +15,7 @@
     <result column="system_catalog" property="systemCatalog" jdbcType="LONGVARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, uid, founding_time, principal, system_url, deleted_sign
+    id, uid, center_name, founding_time, principal, comment, system_url, deleted_sign
   </sql>
   <sql id="Blob_Column_List" >
     system_catalog
@@ -31,11 +33,11 @@
     where id = #{id,jdbcType=VARCHAR}
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.OrgTechCenter" >
-    insert into org_tech_center (id, uid, founding_time, 
+    insert into org_tech_center (id, uid, center_name, founding_time, 
       principal, system_url, deleted_sign, 
       system_catalog)
-    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{foundingTime,jdbcType=TIMESTAMP}, 
-      #{principal,jdbcType=VARCHAR}, #{systemUrl,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, 
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{centerName,jdbcType=VARCHAR}, #{foundingTime,jdbcType=TIMESTAMP}, 
+      #{principal,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR}, #{systemUrl,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, 
       #{systemCatalog,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgTechCenter" >
@@ -47,12 +49,18 @@
       <if test="uid != null" >
         uid,
       </if>
+      <if test="centerName != null" >
+        center_name,
+      </if>
       <if test="foundingTime != null" >
         founding_time,
       </if>
       <if test="principal != null" >
         principal,
       </if>
+      <if test="comment != null" >
+        comment,
+      </if>
       <if test="systemUrl != null" >
         system_url,
       </if>
@@ -70,12 +78,18 @@
       <if test="uid != null" >
         #{uid,jdbcType=VARCHAR},
       </if>
+      <if test="centerName != null" >
+        #{centerName,jdbcType=VARCHAR},
+      </if>
       <if test="foundingTime != null" >
         #{foundingTime,jdbcType=TIMESTAMP},
       </if>
       <if test="principal != null" >
         #{principal,jdbcType=VARCHAR},
       </if>
+      <if test="comment != null" >
+        #{comment,jdbcType=VARCHAR},
+      </if>
       <if test="systemUrl != null" >
         #{systemUrl,jdbcType=VARCHAR},
       </if>
@@ -93,12 +107,18 @@
       <if test="uid != null" >
         uid = #{uid,jdbcType=VARCHAR},
       </if>
-      <if test="foundingTime != null" >
+      <if test="centerName != null" >
+        center_name = #{centerName,jdbcType=VARCHAR},
+      </if>
+       <if test="foundingTime != null" >
         founding_time = #{foundingTime,jdbcType=TIMESTAMP},
       </if>
       <if test="principal != null" >
         principal = #{principal,jdbcType=VARCHAR},
       </if>
+       <if test="comment != null" >
+        comment = #{comment,jdbcType=VARCHAR},
+      </if>
       <if test="systemUrl != null" >
         system_url = #{systemUrl,jdbcType=VARCHAR},
       </if>
@@ -114,8 +134,10 @@
   <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.OrgTechCenter" >
     update org_tech_center
     set uid = #{uid,jdbcType=VARCHAR},
+      center_name = #{centerName,jdbcType=VARCHAR},
       founding_time = #{foundingTime,jdbcType=TIMESTAMP},
       principal = #{principal,jdbcType=VARCHAR},
+      comment = #{comment,jdbcType=VARCHAR},
       system_url = #{systemUrl,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER},
       system_catalog = #{systemCatalog,jdbcType=LONGVARCHAR}
@@ -124,8 +146,10 @@
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrgTechCenter" >
     update org_tech_center
     set uid = #{uid,jdbcType=VARCHAR},
+      center_name = #{centerName,jdbcType=VARCHAR},
       founding_time = #{foundingTime,jdbcType=TIMESTAMP},
       principal = #{principal,jdbcType=VARCHAR},
+      comment = #{comment,jdbcType=VARCHAR},
       system_url = #{systemUrl,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}

+ 14 - 3
src/main/java/com/goafanti/common/mapper/OrgTechProductMapper.xml

@@ -18,12 +18,13 @@
     <result column="condition_effect" property="conditionEffect" jdbcType="VARCHAR" />
     <result column="year" property="year" jdbcType="INTEGER" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="account_url" property="accountUrl" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
     id, uid, serial_number, product_name, technical_field1, technical_field2, technical_field3, 
     technical_source, last_year_revenue, main_product, intellectual_property_number, 
-    key_technology, competitive_edge, condition_effect, year, create_time, deleted_sign
+    key_technology, competitive_edge, condition_effect, year, create_time, account_url, deleted_sign
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -41,13 +42,13 @@
       technical_field3, technical_source, last_year_revenue, 
       main_product, intellectual_property_number, 
       key_technology, competitive_edge, condition_effect, 
-      year, create_time, deleted_sign)
+      year, create_time, account_url, deleted_sign)
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{serialNumber,jdbcType=VARCHAR}, 
       #{productName,jdbcType=VARCHAR}, #{technicalField1,jdbcType=INTEGER}, #{technicalField2,jdbcType=INTEGER}, 
       #{technicalField3,jdbcType=INTEGER}, #{technicalSource,jdbcType=INTEGER}, #{lastYearRevenue,jdbcType=VARCHAR}, 
       #{mainProduct,jdbcType=INTEGER}, #{intellectualPropertyNumber,jdbcType=VARCHAR}, 
       #{keyTechnology,jdbcType=VARCHAR}, #{competitiveEdge,jdbcType=VARCHAR}, #{conditionEffect,jdbcType=VARCHAR}, 
-      #{year,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{deletedSign,jdbcType=INTEGER})
+      #{year,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{accountUrl,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgTechProduct" >
     insert into org_tech_product
@@ -100,6 +101,9 @@
       <if test="createTime != null" >
         create_time,
       </if>
+       <if test="accountUrl != null" >
+        account_url,
+      </if>
        <if test="deletedSign != null" >
         deleted_sign,
       </if>
@@ -153,6 +157,9 @@
       <if test="createTime != null" >
         #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="accountUrl != null" >
+        #{accountUrl,jdbcType=VARCHAR},
+      </if>
       <if test="deletedSign != null" >
         #{deletedSign,jdbcType=INTEGER},
       </if>
@@ -206,6 +213,9 @@
       <if test="createTime != null" >
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="accountUrl != null" >
+        account_url = #{accountUrl,jdbcType=VARCHAR},
+      </if>
       <if test="deletedSign != null" >
         deleted_sign = #{deletedSign,jdbcType=INTEGER},
       </if>
@@ -229,6 +239,7 @@
       condition_effect = #{conditionEffect,jdbcType=VARCHAR},
       year = #{year,jdbcType=INTEGER},
       create_time = #{createTime,jdbcType=TIMESTAMP},
+      account_url = #{accountUrl,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>

+ 14 - 1
src/main/java/com/goafanti/common/model/OrgActivity.java

@@ -35,6 +35,11 @@ public class OrgActivity {
      * 参与人员
      */
     private String participant;
+    
+    /**
+     * 是否是内部立项
+     */
+    private Integer projectMode;
 
     /**
     * 技术领域1st select
@@ -261,7 +266,15 @@ public class OrgActivity {
     
     
     
-    public String getProofUrl() {
+    public Integer getProjectMode() {
+		return projectMode;
+	}
+
+	public void setProjectMode(Integer projectMode) {
+		this.projectMode = projectMode;
+	}
+
+	public String getProofUrl() {
 		return proofUrl;
 	}
 

+ 15 - 1
src/main/java/com/goafanti/common/model/OrgActivityCost.java

@@ -81,6 +81,11 @@ public class OrgActivityCost {
     private Date startDate;
 
     private Date endDate;
+    
+    /**
+     * 台帐URL
+     */
+    private String accountUrl;
 
     /**
     * 删除标记
@@ -231,7 +236,16 @@ public class OrgActivityCost {
         this.endDate = endDate;
     }
     
-    @JsonIgnore
+    
+    public String getAccountUrl() {
+		return accountUrl;
+	}
+
+	public void setAccountUrl(String accountUrl) {
+		this.accountUrl = accountUrl;
+	}
+
+	@JsonIgnore
     public Integer getDeletedSign() {
         return deletedSign;
     }

+ 18 - 2
src/main/java/com/goafanti/common/model/OrgFinance.java

@@ -1,6 +1,9 @@
 package com.goafanti.common.model;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgFinance {
     private String id;
@@ -8,7 +11,7 @@ public class OrgFinance {
     private String uid;
 
     /**
-    * 主营业务收入
(万元)
+    * 主营业务收入
      (万元)
     */
     private Integer mainBusinessIncome;
 
@@ -33,7 +36,7 @@ public class OrgFinance {
     private Integer currentAsset;
 
     /**
-    * 固定资产净额
(万元)
+    * 固定资产净额
		(万元)
     */
     private Integer netFixedAsset;
 
@@ -206,6 +209,19 @@ public class OrgFinance {
 		this.year = year;
 	}
 	
+	//财务报表
+	public String getFinanceDownloadFileName(){
+		if (StringUtils.isBlank(this.financeUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.financeUrl);
+		}
+	}
+	
+	public void setFinanceDownloadFileName(String protocolDownloadFileName){
+		
+	}
+	
 	
     
     

+ 29 - 1
src/main/java/com/goafanti/common/model/OrgHonorDatum.java

@@ -2,9 +2,11 @@ package com.goafanti.common.model;
 
 import java.util.Date;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgHonorDatum {
     private String id;
@@ -15,6 +17,11 @@ public class OrgHonorDatum {
     * 荣誉或证明材料名称
     */
     private String name;
+    
+    /**
+     * 发证机构
+     */
+    private String issuingMechanism;
 
     /**
     * 发证时间
@@ -54,8 +61,16 @@ public class OrgHonorDatum {
     public void setName(String name) {
         this.name = name;
     }
+    
+    public String getIssuingMechanism() {
+		return issuingMechanism;
+	}
 
-    public Date getIssuingTime() {
+	public void setIssuingMechanism(String issuingMechanism) {
+		this.issuingMechanism = issuingMechanism;
+	}
+
+	public Date getIssuingTime() {
         return issuingTime;
     }
 
@@ -91,4 +106,17 @@ public class OrgHonorDatum {
 	public void setIssuingTimeFormattedDate(String issuingTimeFormattedDate){
 		
 	}
+	
+	//附件
+	public String getEnclosureDownloadFileName(){
+		if (StringUtils.isBlank(this.enclosureUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.enclosureUrl);
+		}
+	}
+		
+	public void setEnclosureDownloadFileName(String enclosureDownloadFileName){
+			
+	}
 }

+ 26 - 1
src/main/java/com/goafanti/common/model/OrgHumanResource.java

@@ -1,6 +1,9 @@
 package com.goafanti.common.model;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgHumanResource {
     private String id;
@@ -416,7 +419,29 @@ public class OrgHumanResource {
 		this.deleteSign = deleteSign;
 	}
 	
-    
+	public String getRosterDownloadFileName(){
+		if (StringUtils.isBlank(this.rosterUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.rosterUrl);
+		}
+	}
+	
+	public void setRosterDownloadFileName(String rosterDownloadFileName){
+		
+	}
+	
+	public String getSocialSecurityDownloadFileName(){
+		if (StringUtils.isBlank(this.socialSecurityUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.socialSecurityUrl);
+		}
+	}
+	
+	public void setSocialSecurityDownloadFileName(String socialSecurityDownloadFileName){
+		
+	}
 	
     
 }

+ 15 - 0
src/main/java/com/goafanti/common/model/OrgRatepay.java

@@ -1,6 +1,9 @@
 package com.goafanti.common.model;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgRatepay {
     private String id;
@@ -153,5 +156,17 @@ public class OrgRatepay {
 		this.year = year;
 	}
     
+	//企业纳税申报表
+	public String getTaxReturnDownloadFileName(){
+		if (StringUtils.isBlank(this.taxReturnUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.taxReturnUrl);
+		}
+	}
+	
+	public void setTaxReturnDownloadFileName(String taxReturnDownloadFileName){
+		
+	}
     
 }

+ 16 - 0
src/main/java/com/goafanti/common/model/OrgTechAchievement.java

@@ -1,7 +1,10 @@
 package com.goafanti.common.model;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat.Shape;
+import com.goafanti.common.utils.FileUtils;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 public class OrgTechAchievement {
@@ -117,4 +120,17 @@ public class OrgTechAchievement {
     public void setDeletedSign(Integer deletedSign) {
         this.deletedSign = deletedSign;
     }
+    
+    //附件
+    public String getEnclosureDownloadFileName(){
+		if (StringUtils.isBlank(this.enclosureUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.enclosureUrl);
+		}
+	}
+	
+	public void setEnclosureDownloadFileName(String enclosureDownloadFileName){
+		
+	}
 }

+ 43 - 2
src/main/java/com/goafanti/common/model/OrgTechCenter.java

@@ -2,14 +2,21 @@ package com.goafanti.common.model;
 
 import java.util.Date;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgTechCenter {
     private String id;
 
     private String uid;
+    
+    /**
+     * 技术中心新名称
+     */
+    private String centerName;
 
     /**
     * 成立时间
@@ -20,6 +27,11 @@ public class OrgTechCenter {
     * 负责人
     */
     private String principal;
+    
+    /**
+     * 备注
+     */
+    private String comment;
 
     /**
     * 制度目录URL
@@ -51,8 +63,16 @@ public class OrgTechCenter {
     public void setUid(String uid) {
         this.uid = uid;
     }
+    
+    public String getCenterName() {
+		return centerName;
+	}
 
-    public Date getFoundingTime() {
+	public void setCenterName(String centerName) {
+		this.centerName = centerName;
+	}
+
+	public Date getFoundingTime() {
         return foundingTime;
     }
 
@@ -93,7 +113,16 @@ public class OrgTechCenter {
         this.systemCatalog = systemCatalog;
     }
     
-    public String getFoundingTimeFormattedDate(){
+    
+    public String getComment() {
+		return comment;
+	}
+
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+
+	public String getFoundingTimeFormattedDate(){
 		if (this.foundingTime == null) {
 			return null;
 		} else {
@@ -104,4 +133,16 @@ public class OrgTechCenter {
 	public void setFoundingTimeFormattedDate(String foundingTimeFormattedDate){
 		
 	}
+	
+	public String getSystemDownloadFileName(){
+		if (StringUtils.isBlank(this.systemUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.systemUrl);
+		}
+	}
+	
+	public void setSystemDownloadFileName(String systemDownloadFileName){
+		
+	}
 }

+ 15 - 0
src/main/java/com/goafanti/common/model/OrgTechCenterDetail.java

@@ -2,9 +2,11 @@ package com.goafanti.common.model;
 
 import java.util.Date;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.utils.FileUtils;
 
 public class OrgTechCenterDetail {
     private String id;
@@ -130,5 +132,18 @@ public class OrgTechCenterDetail {
 		
 	}
 	
+	//技术协议名称
+	public String getProtocolDownloadFileName(){
+		if (StringUtils.isBlank(this.protocolUrl)){
+			return null;
+		} else {
+			return (null == this.projectName) ? "" : this.projectName  + FileUtils.getDownloadFileName(this.protocolUrl);
+		}
+	}
+	
+	public void setProtocolDownloadFileName(String protocolDownloadFileName){
+		
+	}
+	
 	
 }

+ 13 - 0
src/main/java/com/goafanti/common/model/OrgTechProduct.java

@@ -85,6 +85,11 @@ public class OrgTechProduct {
     private Date createTime;
     
     /**
+     * 
+     */
+    private String accountUrl;
+    
+    /**
      * 删除标记
      */
     private Integer deletedSign;
@@ -222,6 +227,14 @@ public class OrgTechProduct {
 		this.createTime = createTime;
 	}
 	
+	public String getAccountUrl() {
+		return accountUrl;
+	}
+
+	public void setAccountUrl(String accountUrl) {
+		this.accountUrl = accountUrl;
+	}
+
 	@JsonIgnore
 	public Integer getDeletedSign() {
 		return deletedSign;

+ 54 - 0
src/main/java/com/goafanti/common/model/PatentInfo.java

@@ -2,10 +2,12 @@ package com.goafanti.common.model;
 
 import java.util.Date;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.goafanti.common.utils.FileUtils;
 @JsonInclude(value = Include.NON_NULL)
 public class PatentInfo {
     private String id;
@@ -432,6 +434,58 @@ public class PatentInfo {
 	public void setCreateTimeFormattedDate(String createTimeFormattedDate){
 		
 	}
+	
+	//专利代理委托书
+	public String getPatentProryStatementDownloadFileName(){
+		if (StringUtils.isBlank(this.patentProryStatementUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.patentProryStatementUrl);
+		}
+	}
+	
+	public void setPatentProryStatementDownloadFileName(String patentProryStatementDownloadFileName){
+		
+	}
+	
+	//专利稿件
+	public String getPatentWritingDownloadFileName(){
+		if (StringUtils.isBlank(this.patentWritingUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.patentWritingUrl);
+		}
+	}
+	
+	public void setPatentWritingDownloadFileName(String patentWritingDownloadFileName){
+		
+	}
+	
+	//授权通知书
+	public String getAuthorizationNoticeDownloadFileName(){
+		if (StringUtils.isBlank(this.authorizationNoticeUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.authorizationNoticeUrl);
+		}
+	}
+	
+	public void setAuthorizationNoticeDownloadFileName(String authorizationNoticeDownloadFileName){
+		
+	}
+	
+	//专利证书
+	public String getPatentCertificateDownloadFileName(){
+		if (StringUtils.isBlank(this.patentCertificateUrl)){
+			return null;
+		} else {
+			return FileUtils.getDownloadFileName(this.patentCertificateUrl);
+		}
+	}
+	
+	public void setPatentCertificateDownloadFileName(String patentCertificateDownloadFileName){
+		
+	}
     
     
 }

+ 0 - 64
src/main/java/com/goafanti/common/utils/DownloadUtils.java

@@ -1,64 +0,0 @@
-package com.goafanti.common.utils;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-
-public class DownloadUtils {
-	/**
-	 * response 输出JSON
-	 * 
-	 * @param hresponse
-	 * @param resultMap
-	 * @throws IOException
-	 */
-	public void out(HttpServletResponse response, String jsonStr) {
-		PrintWriter out = null;
-		try {
-			response.setHeader("Content-Type", "application/json");
-			response.setCharacterEncoding("UTF-8");
-			out = response.getWriter();
-			out.println(jsonStr);
-		} catch (Exception e) {
-			LoggerUtils.fmtError(getClass(), e, "输出数据失败");
-		} finally {
-			if (null != out) {
-				out.flush();
-				out.close();
-			}
-		}
-	}
-
-	public void downloadExcel(HttpServletResponse response, String fileName, HSSFWorkbook workbook) {
-		String fn = null;
-		try {
-			fn = URLEncoder.encode(fileName, "UTF-8");
-		} catch (UnsupportedEncodingException e1) {
-			fn = fileName;
-		}
-		response.setContentType("application/x-download;charset=UTF-8");
-		response.setHeader("Content-Disposition", "attachment; filename=\"" + fn + "\";");
-		OutputStream out = null;
-		try {
-			out = response.getOutputStream();
-			workbook.write(out);
-		} catch (IOException e) {
-			LoggerUtils.fmtError(getClass(), e, "输出Excel失败");
-		} finally {
-			if (null != out) {
-				try {
-					out.flush();
-					out.close();
-				} catch (IOException e) {
-					out = null;
-				}
-			}
-		}
-	}
-}

+ 220 - 0
src/main/java/com/goafanti/common/utils/FileUtils.java

@@ -0,0 +1,220 @@
+package com.goafanti.common.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.goafanti.common.bo.Result;
+
+public class FileUtils {
+	@Value(value = "${upload.private.path}")
+	private String							uploadPrivatePath	= null;
+	
+	
+	/**
+	 * response 输出JSON
+	 * 
+	 * @param hresponse
+	 * @param resultMap
+	 * @throws IOException
+	 */
+	public void out(HttpServletResponse response, String jsonStr) {
+		PrintWriter out = null;
+		try {
+			response.setHeader("Content-Type", "application/json");
+			response.setCharacterEncoding("UTF-8");
+			out = response.getWriter();
+			out.println(jsonStr);
+		} catch (Exception e) {
+			LoggerUtils.fmtError(getClass(), e, "输出数据失败");
+		} finally {
+			if (null != out) {
+				out.flush();
+				out.close();
+			}
+		}
+	}
+
+	/**
+	 * Excel报表导出
+	 * 
+	 * @param response
+	 * @param fileName
+	 * @param workbook
+	 */
+	public void downloadExcel(HttpServletResponse response, String fileName, HSSFWorkbook workbook) {
+		String fn = null;
+		try {
+			fn = URLEncoder.encode(fileName, "UTF-8");
+		} catch (UnsupportedEncodingException e1) {
+			fn = fileName;
+		}
+		response.setContentType("application/x-download;charset=UTF-8");
+		response.setHeader("Content-Disposition", "attachment; filename=\"" + fn + "\";");
+		OutputStream out = null;
+		try {
+			out = response.getOutputStream();
+			workbook.write(out);
+		} catch (IOException e) {
+			LoggerUtils.fmtError(getClass(), e, "输出Excel失败");
+		} finally {
+			if (null != out) {
+				try {
+					out.flush();
+					out.close();
+				} catch (IOException e) {
+					out = null;
+				}
+			}
+		}
+	}
+
+	/**
+	 * 根据上传文件 拼接fileName
+	 * 
+	 * @param mf
+	 * @param isPrivate
+	 * @param sign
+	 * @param path
+	 * @return
+	 */
+	public static String mosaicFileName(MultipartFile mf, boolean isPrivate, String sign, String path, String uid) {
+		String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
+		String fileName = "";
+		if (isPrivate || sign != "") {
+			fileName = path + "/" + uid + "/" + sign + suffix;
+
+		} else {
+			fileName = path + System.nanoTime() + suffix;
+		}
+		return fileName;
+	}
+
+	/**
+	 * 获取下载文件名称
+	 * 
+	 * @param path
+	 * @return
+	 */
+	public static String getDownloadFileName(String path) {
+		if (StringUtils.isBlank(path)) {
+			return null;
+		}
+		String fileName = "";
+		String prefix = "";
+		String suffix = path.substring(path.lastIndexOf("."));
+		if (path.indexOf("patent_prory_statement") != -1) {
+			prefix = "专利代理委托书";
+		}
+
+		if (path.indexOf("patent_writing") != -1) {
+			prefix = "专利稿件";
+		}
+
+		if (path.indexOf("authorization_notice") != -1) {
+			prefix = "授权通知书";
+		}
+
+		if (path.indexOf("patent_certificate") != -1) {
+			prefix = "专利证书";
+		}
+
+		if (path.indexOf("roster") != -1) {
+			prefix = subStr(path) + "花名册";
+		}
+
+		if (path.indexOf("social_security") != -1) {
+			prefix = subStr(path) + "社保情况";
+		}
+
+		if (path.indexOf("honor") != -1) {
+			prefix = "企业荣誉及材料证明";
+		}
+
+		if (path.indexOf("achievement") != -1) {
+			prefix = "科技成果";
+		}
+
+		if (path.indexOf("institution") != -1) {
+			prefix = "技术中心制度";
+		}
+
+		if (path.indexOf("protocol") != -1) {
+			prefix = "技术协议";
+		}
+
+		if (path.indexOf("finance") != -1) {
+			prefix = subStr(path) + "财务报表";
+		}
+
+		if (path.indexOf("ratepay") != -1) {
+			prefix = subStr(path) + "纳税申报表";
+		}
+
+		fileName = prefix + suffix;
+		return fileName;
+	}
+	
+	
+	/**
+	 * 下载文件
+	 * @param res
+	 * @param fileName
+	 * @param response
+	 * @param path
+	 * @param request
+	 * @return
+	 */
+	public Result downloadFile(Result res, String fileName, HttpServletResponse response, String path) {
+		String fileSaveRootPath = uploadPrivatePath + path;
+		InputStream in = null;
+		OutputStream out = null;
+		byte[] buffer = new byte[8 * 1024];
+		try {
+			File file = new File(fileSaveRootPath);
+			in = new FileInputStream(file);
+			out = response.getOutputStream();
+			// 设置文件MIME类型
+			response.setContentType("application/octet-stream");
+			response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
+			for (;;) {
+				int bytes = in.read(buffer);
+				if (bytes == -1) {
+					break;
+				}
+				out.write(buffer, 0, bytes);
+			}
+		} catch (IOException e) {
+			LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+		} finally {
+			try {
+				in.close();
+			} catch (IOException e) {
+				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+			}
+			try {
+				out.close();
+			} catch (IOException e) {
+				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+			}
+		}
+		return res;
+	}
+
+	// year
+	private static String subStr(String s) {
+		return "企业" + s.substring(s.lastIndexOf("_") + 1, s.lastIndexOf("."));
+	}
+
+}

+ 4 - 8
src/main/java/com/goafanti/techservice/cognizance/controller/CognizanceApiController.java

@@ -31,6 +31,7 @@ import com.goafanti.common.model.OrgTechCenter;
 import com.goafanti.common.model.OrgTechCenterDetail;
 import com.goafanti.common.model.OrgTechProduct;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.FileUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -584,7 +585,7 @@ public class CognizanceApiController extends BaseApiController {
 	}
 
 	/**
-	 * 高企相关材料上传
+	 * 高企相关材料上传(技术协议除外)
 	 * 
 	 * @param req
 	 * @param sign
@@ -833,15 +834,10 @@ public class CognizanceApiController extends BaseApiController {
 	private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign,
 			String uid) {
 		List<MultipartFile> files = getFiles(req);
-		String fileName = "";
-		if (StringUtils.isBlank(uid)) {
-			fileName = path + TokenManager.getUserId() + "_" + sign + ".jpg";
-		} else {
-			fileName = path + uid + "_" + sign + ".jpg";
-		}
+		MultipartFile mf = files.get(0);
+		String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
 		if (!files.isEmpty()) {
 			try {
-				MultipartFile mf = files.get(0);
 				mf.transferTo(toPrivateFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (IllegalStateException | IOException e) {

+ 55 - 0
src/main/java/com/goafanti/techservice/patent/bo/PatentCompositeBo.java

@@ -2,8 +2,11 @@ package com.goafanti.techservice.patent.bo;
 
 import java.util.Date;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
+import com.goafanti.common.utils.FileUtils;
+
 
 /**
  * 管理端综合管理
@@ -384,6 +387,58 @@ public class PatentCompositeBo {
 		public void setCreateTimeFormattedDate(String createTimeFormattedDate){
 			
 		}
+	
+		//专利代理委托书
+		public String getPatentProryStatementDownloadFileName(){
+			if (StringUtils.isBlank(this.patentProryStatementUrl)){
+				return null;
+			} else {
+				return FileUtils.getDownloadFileName(this.patentProryStatementUrl);
+			}
+		}
+		
+		public void setPatentProryStatementDownloadFileName(String patentProryStatementDownloadFileName){
+			
+		}
+		
+		//专利稿件
+		public String getPatentWritingDownloadFileName(){
+			if (StringUtils.isBlank(this.patentWritingUrl)){
+				return null;
+			} else {
+				return FileUtils.getDownloadFileName(this.patentWritingUrl);
+			}
+		}
+		
+		public void setPatentWritingDownloadFileName(String patentWritingDownloadFileName){
+			
+		}
+		
+		//授权通知书
+		public String getAuthorizationNoticeDownloadFileName(){
+			if (StringUtils.isBlank(this.authorizationNoticeUrl)){
+				return null;
+			} else {
+				return FileUtils.getDownloadFileName(this.authorizationNoticeUrl);
+			}
+		}
+		
+		public void setAuthorizationNoticeDownloadFileName(String authorizationNoticeDownloadFileName){
+			
+		}
+		
+		//专利证书
+		public String getPatentCertificateDownloadFileName(){
+			if (StringUtils.isBlank(this.patentCertificateUrl)){
+				return null;
+			} else {
+				return FileUtils.getDownloadFileName(this.patentCertificateUrl);
+			}
+		}
+		
+		public void setPatentCertificateDownloadFileName(String patentCertificateDownloadFileName){
+			
+		}
     
     
     

+ 23 - 32
src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java

@@ -1,10 +1,6 @@
 package com.goafanti.techservice.patent.controller;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.text.ParseException;
 import java.util.Calendar;
 import java.util.Date;
@@ -40,7 +36,7 @@ import com.goafanti.common.model.PatentInfo;
 import com.goafanti.common.model.PatentLog;
 import com.goafanti.common.model.PatentRegistration;
 import com.goafanti.common.utils.DateUtils;
-import com.goafanti.common.utils.DownloadUtils;
+import com.goafanti.common.utils.FileUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -522,7 +518,7 @@ public class PatentApiController extends BaseApiController {
 		if (res.getError().isEmpty()) {
 			exportComosites(response, composites);
 		} else {
-			DownloadUtils downloadUtils = new DownloadUtils();
+			FileUtils downloadUtils = new FileUtils();
 			downloadUtils.out(response, res.toString());
 		}
 		return res;
@@ -540,7 +536,7 @@ public class PatentApiController extends BaseApiController {
 		if (res.getError().isEmpty()) {
 			exportPendings(response, pendings);
 		} else {
-			DownloadUtils downloadUtils = new DownloadUtils();
+			FileUtils downloadUtils = new FileUtils();
 			downloadUtils.out(response, res.toString());
 		}
 		return res;
@@ -562,7 +558,7 @@ public class PatentApiController extends BaseApiController {
 		if (res.getError().isEmpty()) {
 			exportFees(response, fees);
 		} else {
-			DownloadUtils downloadUtils = new DownloadUtils();
+			FileUtils downloadUtils = new FileUtils();
 			downloadUtils.out(response, res.toString());
 		}
 
@@ -633,7 +629,7 @@ public class PatentApiController extends BaseApiController {
 					: calDeadline(obj.getPatentApplicationDateFormattedDate()));
 
 		}
-		DownloadUtils downloadUtils = new DownloadUtils();
+		FileUtils downloadUtils = new FileUtils();
 		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 	}
 
@@ -689,7 +685,7 @@ public class PatentApiController extends BaseApiController {
 					: calDeadline(obj.getAuthorizedDateFormattedDate()));
 
 		}
-		DownloadUtils downloadUtils = new DownloadUtils();
+		FileUtils downloadUtils = new FileUtils();
 		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 	}
 
@@ -720,7 +716,7 @@ public class PatentApiController extends BaseApiController {
 			row.createCell(10).setCellValue(obj.getPatentApplicationFormattedDate());
 			row.createCell(11).setCellValue(obj.getAuthor());
 		}
-		DownloadUtils downloadUtils = new DownloadUtils();
+		FileUtils downloadUtils = new FileUtils();
 		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 
 	}
@@ -754,7 +750,7 @@ public class PatentApiController extends BaseApiController {
 	@RequestMapping(value = "/patentFile", method = RequestMethod.POST)
 	public Result patentFile(HttpServletRequest req, String sign, String oid) {
 		Result res = new Result();
-		String fileName = "";
+		/*String fileName = "";
 		if (StringUtils.isBlank(oid)) {
 			fileName = "/patent/" + TokenManager.getUserId() + "_" + sign + ".doc";
 		} else {
@@ -763,8 +759,9 @@ public class PatentApiController extends BaseApiController {
 			} else {
 				fileName = "/patent/" + oid + "_" + sign + ".jpg";
 			}
-		}
-		res.setData(handleFile(res, fileName, req));
+		}*/
+		//res.setData(handleFile(res, fileName, req));
+		res.setData(handleFile(res, "/patent/", true, req, sign,  oid));
 		return res;
 	}
 
@@ -774,11 +771,11 @@ public class PatentApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
-	public Result downloadPatentProryStatement(HttpServletResponse response, HttpServletRequest request) {
+	public Result downloadPatentProryStatement(HttpServletResponse response, String fileName) {
 		Result res = new Result();
-		String filename = "Patent" + Long.toString(System.nanoTime()) + ".doc";
-		String fileSaveRootPath = uploadPrivatePath + "/patent/patent_prory_statement.doc";
-		return patentDownload(res, response, filename, fileSaveRootPath);
+		FileUtils f = new FileUtils();
+		String path =  "/patent/patent_prory_statement.doc";
+		return f.downloadFile(res, fileName, response, path);
 	}
 
 	/**
@@ -787,25 +784,18 @@ public class PatentApiController extends BaseApiController {
 	 * @return
 	 */
 	@RequestMapping(value = "/downloadFile", method = RequestMethod.GET)
-	public Result downloadPatentFile(HttpServletResponse response, String path, String sign,
-			HttpServletRequest request) {
+	public Result downloadPatentFile(HttpServletResponse response, String path, String fileName) {
 		Result res = new Result();
 		if (StringUtils.isBlank(path)) {
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			return res;
 		}
-		String filename = "";
-		if (sign.equals("patent_prory_statement") || sign.equals("patent_writing")) {
-			filename = Long.toString(System.nanoTime()) + ".doc";
-		} else {
-			filename = Long.toString(System.nanoTime()) + ".jpg";
-		}
-		String fileSaveRootPath = uploadPrivatePath + path;
-		return patentDownload(res, response, filename, fileSaveRootPath);
+		FileUtils f = new FileUtils();
+		return f.downloadFile(res, fileName, response, path);
 
 	}
 
-	private Result patentDownload(Result res, HttpServletResponse response, String filename, String fileSaveRootPath) {
+	/*private Result patentDownload(Result res, HttpServletResponse response, String filename, String fileSaveRootPath) {
 		InputStream in = null;
 		OutputStream out = null;
 		byte[] buffer = new byte[8 * 1024];
@@ -839,13 +829,14 @@ public class PatentApiController extends BaseApiController {
 		}
 		return res;
 
-	}
+	}*/
 
-	private String handleFile(Result res, String fileName, HttpServletRequest req) {
+	private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign, String oid) {
 		List<MultipartFile> files = getFiles(req);
+		MultipartFile mf = files.get(0);
+		String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, StringUtils.isBlank(oid) ? TokenManager.getUserId() : oid);
 		if (!files.isEmpty()) {
 			try {
-				MultipartFile mf = files.get(0);
 				mf.transferTo(toPrivateFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (IllegalStateException | IOException e) {

+ 4 - 21
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -31,6 +31,7 @@ import com.goafanti.common.model.UserCareer;
 import com.goafanti.common.model.UserEdu;
 import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.model.UserInfo;
+import com.goafanti.common.utils.FileUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.TimeUtils;
@@ -271,32 +272,13 @@ public class UserApiController extends BaseApiController {
 		return res;
 	}
 
-	/**
-	 * 专利
-	 * 
-	 * @param req
-	 * @return
-	 *//*
-		 * 
-		 * @RequestMapping(value = "/patent/upload", method =
-		 * RequestMethod.POST) public Result patentFile(HttpServletRequest req
-		 * ,String sign) { Result res = new Result();
-		 * res.setData(handleFile(res, "/patent/", true, req, sign)); return
-		 * res; }
-		 */
 
 	private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign) {
 		List<MultipartFile> files = getFiles(req);
-		String fileName = "";
-		if (isPrivate || sign != "") {
-			fileName = path + TokenManager.getUserId() + "_" + sign + ".jpg";
-
-		} else {
-			fileName = path + System.nanoTime() + ".jpg";
-		}
+		MultipartFile mf = files.get(0);
+		String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path, TokenManager.getUserId());
 		if (!files.isEmpty()) {
 			try {
-				MultipartFile mf = files.get(0);
 				mf.transferTo(isPrivate ? toPrivateFile(fileName) : toFile(fileName));
 				LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
 			} catch (IllegalStateException | IOException e) {
@@ -940,5 +922,6 @@ public class UserApiController extends BaseApiController {
 			}
 			return res;
 		}
+	
 
 }