Antiloveg лет назад: 9
Родитель
Сommit
5839446973

+ 55 - 8
src/main/java/com/goafanti/common/mapper/PatentInfoMapper.xml

@@ -31,6 +31,7 @@
     <result column="authorized_date" property="authorizedDate" jdbcType="TIMESTAMP" />
     <result column="authorized_date" property="authorizedDate" jdbcType="TIMESTAMP" />
     <result column="office" property="office" jdbcType="VARCHAR" />
     <result column="office" property="office" jdbcType="VARCHAR" />
     <result column="principal" property="principal" jdbcType="VARCHAR" />
     <result column="principal" property="principal" jdbcType="VARCHAR" />
+    <result column="confirm_state" property="confirmState" jdbcType="INTEGER" />
   </resultMap>
   </resultMap>
   <sql id="Base_Column_List" >
   <sql id="Base_Column_List" >
     id, uid, serial_number, patent_number, patent_name, patent_catagory, patent_state, 
     id, uid, serial_number, patent_number, patent_name, patent_catagory, patent_state, 
@@ -38,7 +39,7 @@
     patent_certificate_url, patent_application_date, first_inventor_name, first_inventor_nationality, 
     patent_certificate_url, patent_application_date, first_inventor_name, first_inventor_nationality, 
     first_inventor_id_number, first_inventor_is_publish, second_inventor_name, second_inventor_nationality, 
     first_inventor_id_number, first_inventor_is_publish, second_inventor_name, second_inventor_nationality, 
     second_inventor_is_publish, third_inventor_name, third_inventor_nationality, third_inventor_is_publish, 
     second_inventor_is_publish, third_inventor_name, third_inventor_nationality, third_inventor_is_publish, 
-    create_time, author, authorized_date,office, principal
+    create_time, author, authorized_date,office, principal ,confirm_state
   </sql>
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
     select 
@@ -62,7 +63,7 @@
       second_inventor_nationality, second_inventor_is_publish, 
       second_inventor_nationality, second_inventor_is_publish, 
       third_inventor_name, third_inventor_nationality, 
       third_inventor_name, third_inventor_nationality, 
       third_inventor_is_publish, create_time, author, authorized_date, 
       third_inventor_is_publish, create_time, author, authorized_date, 
-      office, principal)
+      office, principal, confirm_state)
      
      
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, 
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, 
       #{patentNumber,jdbcType=VARCHAR}, #{patentName,jdbcType=VARCHAR}, #{patentCatagory,jdbcType=INTEGER}, 
       #{patentNumber,jdbcType=VARCHAR}, #{patentName,jdbcType=VARCHAR}, #{patentCatagory,jdbcType=INTEGER}, 
@@ -76,7 +77,7 @@
       #{thirdInventorName,jdbcType=VARCHAR}, #{thirdInventorNationality,jdbcType=VARCHAR}, 
       #{thirdInventorName,jdbcType=VARCHAR}, #{thirdInventorNationality,jdbcType=VARCHAR}, 
       #{thirdInventorIsPublish,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{author,jdbcType=VARCHAR}, 
       #{thirdInventorIsPublish,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{author,jdbcType=VARCHAR}, 
       #{authorizedDate,jdbcType=TIMESTAMP},
       #{authorizedDate,jdbcType=TIMESTAMP},
-      #{office,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR})
+      #{office,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{confirmState,jdbcType=INTEGER})
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentInfo" >
   <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentInfo" >
     insert into patent_info
     insert into patent_info
@@ -168,6 +169,9 @@
       <if test="principal != null" >
       <if test="principal != null" >
         principal,
         principal,
       </if>
       </if>
+      <if test="confirmState != null">
+        confirm_state,
+      </if>
     </trim>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="id != null" >
       <if test="id != null" >
@@ -257,6 +261,9 @@
       <if test="principal != null" >
       <if test="principal != null" >
         #{principal,jdbcType=VARCHAR},
         #{principal,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="confirmState != null">
+        #{confirmState,jdbcType=INTEGER}
+      </if>
     </trim>
     </trim>
   </insert>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PatentInfo" >
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PatentInfo" >
@@ -346,6 +353,9 @@
       <if test="principal != null" >
       <if test="principal != null" >
         principal = #{principal,jdbcType=VARCHAR},
         principal = #{principal,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="confirmState != null">
+        confirmState = #{confirmState,jdbcType=INTEGER},
+      </if>
     </set>
     </set>
     where id = #{id,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   </update>
@@ -378,7 +388,8 @@
       author = #{author,jdbcType=VARCHAR},
       author = #{author,jdbcType=VARCHAR},
       authorized_date = #{authorizedDate,jdbcType=VARCHAR},
       authorized_date = #{authorizedDate,jdbcType=VARCHAR},
       office = #{office,jdbcType=VARCHAR},
       office = #{office,jdbcType=VARCHAR},
-      principal = #{principal,jdbcType=VARCHAR}
+      principal = #{principal,jdbcType=VARCHAR},
+      confirmState = #{confirmState,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   </update>
   
   
@@ -422,7 +433,24 @@
   </select>
   </select>
   
   
   <select id="findManagePatentListByPage" resultType="com.goafanti.techservice.patent.bo.PatentCompositeBo"  parameterType="String">
   <select id="findManagePatentListByPage" resultType="com.goafanti.techservice.patent.bo.PatentCompositeBo"  parameterType="String">
-  	select  u.id as uid ,o.id as oid , p.id as pid , p.serial_number as serialNumber , p.patent_number as patentNumber , p.office , 
+  select    a.name as author,x.uid  , 
+	          x.oid  ,x.pid ,
+			  x.serialNumber,x.patentNumber,
+			  x.office , x.unitName ,
+			  x.patentCatagory , x.patentName , 
+			  x.patentState , x.createTime ,
+			  x.patentApplicationDate,x.authorizedDate , 
+			  x.orgCode , x.locationProvince , 
+			  x.locationCity , x.locationArea ,
+			  x.contacts , x.patentField , 
+			  x.patentDes ,x.firstInventorName,
+			  x.firstInventorNationality , x.firstInventorIdNumber ,
+			  x.secondInventorName, x.secondInventorNationality ,
+         x.thirdInventorName  , x.thirdInventorNationality , 
+			  x.patentProryStatementUrl, x.lastYearTaxReportUrl , 
+			  x.patentWritingUrl, x.authorizationNoticeUrl,
+			  x.patentCertificateUrl from
+  	   (select  u.id as uid ,o.id as oid , p.id as pid , p.serial_number as serialNumber , p.patent_number as patentNumber , p.office , 
 	  	    o.unit_name as unitName,
 	  	    o.unit_name as unitName,
 			p.patent_catagory as patentCatagory,p.patent_name as patentName,p.patent_state as patentState,p.create_time as createTime,
 			p.patent_catagory as patentCatagory,p.patent_name as patentName,p.patent_state as patentState,p.create_time as createTime,
 			p.patent_application_date as patentApplicationDate,
 			p.patent_application_date as patentApplicationDate,
@@ -485,7 +513,8 @@
 	<if test="locationProvince != null">
 	<if test="locationProvince != null">
 	    and  o.location_province=#{locationProvince,jdbcType=VARCHAR}
 	    and  o.location_province=#{locationProvince,jdbcType=VARCHAR}
 	</if>
 	</if>
-	 order by p.create_time desc
+	 order by p.create_time desc) x
+	 LEFT JOIN admin a on a.id = x.author
 	 <if test="page_sql!=null">
 	 <if test="page_sql!=null">
 		${page_sql}
 		${page_sql}
 	</if>
 	</if>
@@ -495,7 +524,24 @@
   <select id="findManagePatentCount" resultType="java.lang.Integer" parameterType="String">
   <select id="findManagePatentCount" resultType="java.lang.Integer" parameterType="String">
    	select count(1) from (
    	select count(1) from (
    	
    	
-		select  u.id as uid ,o.id as oid , p.id as pid , p.serial_number as serialNumber , p.patent_number as patentNumber , p.office , 
+		select    a.name as author,x.uid  , 
+	          x.oid  ,x.pid ,
+			  x.serialNumber,x.patentNumber,
+			  x.office , x.unitName ,
+			  x.patentCatagory , x.patentName , 
+			  x.patentState , x.createTime ,
+			  x.patentApplicationDate,x.authorizedDate , 
+			  x.orgCode , x.locationProvince , 
+			  x.locationCity , x.locationArea ,
+			  x.contacts , x.patentField , 
+			  x.patentDes ,x.firstInventorName,
+			  x.firstInventorNationality , x.firstInventorIdNumber ,
+			  x.secondInventorName, x.secondInventorNationality ,
+         x.thirdInventorName  , x.thirdInventorNationality , 
+			  x.patentProryStatementUrl, x.lastYearTaxReportUrl , 
+			  x.patentWritingUrl, x.authorizationNoticeUrl,
+			  x.patentCertificateUrl from
+  	   (select  u.id as uid ,o.id as oid , p.id as pid , p.serial_number as serialNumber , p.patent_number as patentNumber , p.office , 
 	  	    o.unit_name as unitName,
 	  	    o.unit_name as unitName,
 			p.patent_catagory as patentCatagory,p.patent_name as patentName,p.patent_state as patentState,p.create_time as createTime,
 			p.patent_catagory as patentCatagory,p.patent_name as patentName,p.patent_state as patentState,p.create_time as createTime,
 			p.patent_application_date as patentApplicationDate,
 			p.patent_application_date as patentApplicationDate,
@@ -558,7 +604,8 @@
 	<if test="locationProvince != null">
 	<if test="locationProvince != null">
 	    and  o.location_province=#{locationProvince,jdbcType=VARCHAR}
 	    and  o.location_province=#{locationProvince,jdbcType=VARCHAR}
 	</if>
 	</if>
-	 order by p.create_time desc
+	 order by p.create_time desc) x
+	 LEFT JOIN admin a on a.id = x.author
 	 <if test="page_sql!=null">
 	 <if test="page_sql!=null">
 		${page_sql}
 		${page_sql}
 	</if>
 	</if>

+ 2 - 1
src/main/java/com/goafanti/common/mapper/PatentLogMapper.xml

@@ -119,7 +119,8 @@
     select b.name as principal , m.operator , m.id , m.pid , m.state , m.comment , m.record_time from 
     select b.name as principal , m.operator , m.id , m.pid , m.state , m.comment , m.record_time from 
 		(select a.name as operator, p.id ,p.pid  , p.state , p.comment ,p.record_time , p.principal as pri
 		(select a.name as operator, p.id ,p.pid  , p.state , p.comment ,p.record_time , p.principal as pri
 		from patent_log p INNER JOIN admin a 
 		from patent_log p INNER JOIN admin a 
-		on a.id = p.operator) m INNER JOIN admin b on m.pri = b. id
+		on a.id = p.operator order by p.record_time desc) m INNER JOIN admin b on m.pri = b. id
     where pid = #{pid,jdbcType=VARCHAR}
     where pid = #{pid,jdbcType=VARCHAR}
+    
   </select>
   </select>
 </mapper>
 </mapper>

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

@@ -143,6 +143,11 @@ public class PatentInfo {
     * 负责人
     * 负责人
     */
     */
     private String principal;
     private String principal;
+    
+    /**
+     * 用户确认申报材料
+     */
+    private Integer confirmState;
 
 
     public String getId() {
     public String getId() {
         return id;
         return id;
@@ -376,6 +381,16 @@ public class PatentInfo {
 		this.authorizedDate = authorizedDate;
 		this.authorizedDate = authorizedDate;
 	}
 	}
 	
 	
+	
+	
+	public Integer getConfirmState() {
+		return confirmState;
+	}
+
+	public void setConfirmState(Integer confirmState) {
+		this.confirmState = confirmState;
+	}
+
 	//授权日/发文日
 	//授权日/发文日
 	public String getAuthorizedFormattedDate() {
 	public String getAuthorizedFormattedDate() {
 		if (this.authorizedDate == null) {
 		if (this.authorizedDate == null) {

+ 13 - 12
src/main/java/com/goafanti/techservice/patent/bo/PatentApplicationFeeBo.java

@@ -34,9 +34,9 @@ public class PatentApplicationFeeBo {
 	
 	
 	private Integer printingFee;
 	private Integer printingFee;
 	
 	
-	private Integer isRequestFunds;
+	private Integer funds;
 	
 	
-	private Integer isReimbursement;
+	private Integer reimbursement;
 	
 	
 	private Date patentApplicationDate;
 	private Date patentApplicationDate;
 	
 	
@@ -146,23 +146,24 @@ public class PatentApplicationFeeBo {
 		this.printingFee = printingFee;
 		this.printingFee = printingFee;
 	}
 	}
 
 
-	public Integer getIsRequestFunds() {
-		return isRequestFunds;
+    	
+	
+
+	public Integer getFunds() {
+		return funds;
 	}
 	}
 
 
-	public void setIsRequestFunds(Integer isRequestFunds) {
-		this.isRequestFunds = isRequestFunds;
+	public void setFunds(Integer funds) {
+		this.funds = funds;
 	}
 	}
 
 
-	public Integer getIsReimbursement() {
-		return isReimbursement;
+	public Integer getReimbursement() {
+		return reimbursement;
 	}
 	}
 
 
-	public void setIsReimbursement(Integer isReimbursement) {
-		this.isReimbursement = isReimbursement;
+	public void setReimbursement(Integer reimbursement) {
+		this.reimbursement = reimbursement;
 	}
 	}
-	
-	
 
 
 	public Date getPatentApplicationDate() {
 	public Date getPatentApplicationDate() {
 		return patentApplicationDate;
 		return patentApplicationDate;

+ 13 - 11
src/main/java/com/goafanti/techservice/patent/bo/PatentCompositeBo.java

@@ -49,8 +49,6 @@ public class PatentCompositeBo {
     
     
     private String contacts;
     private String contacts;
     
     
-    private Integer number;
-    
     private Integer patentField;
     private Integer patentField;
     
     
     private String patentDes;
     private String patentDes;
@@ -67,6 +65,8 @@ public class PatentCompositeBo {
     
     
     private String thirdInventorName;
     private String thirdInventorName;
     
     
+    private String thirdInventorNationality;
+    
     private String lastYearTaxReportUrl;
     private String lastYearTaxReportUrl;
     
     
     private String patentProryStatementUrl;
     private String patentProryStatementUrl;
@@ -225,14 +225,6 @@ public class PatentCompositeBo {
 		this.contacts = contacts;
 		this.contacts = contacts;
 	}
 	}
 
 
-	public Integer getNumber() {
-		return number;
-	}
-
-	public void setNumber(Integer number) {
-		this.number = number;
-	}
-
 	public Integer getPatentField() {
 	public Integer getPatentField() {
 		return patentField;
 		return patentField;
 	}
 	}
@@ -345,7 +337,17 @@ public class PatentCompositeBo {
 		this.patentProryStatementUrl = patentProryStatementUrl;
 		this.patentProryStatementUrl = patentProryStatementUrl;
 	}
 	}
 	
 	
-	//授权日/发文日
+	
+	
+	public String getThirdInventorNationality() {
+		return thirdInventorNationality;
+	}
+
+	public void setThirdInventorNationality(String thirdInventorNationality) {
+		this.thirdInventorNationality = thirdInventorNationality;
+	}
+
+		//授权日/发文日
 		public String getAuthorizedFormattedDate() {
 		public String getAuthorizedFormattedDate() {
 			if (this.authorizedDate == null) {
 			if (this.authorizedDate == null) {
 				return null;
 				return null;

+ 319 - 10
src/main/java/com/goafanti/techservice/patent/controller/PatentApiController.java

@@ -6,7 +6,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStream;
 import java.text.ParseException;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashMap;
@@ -18,7 +17,12 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 
 
-import org.junit.Test;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,6 +40,7 @@ import com.goafanti.common.model.PatentInfo;
 import com.goafanti.common.model.PatentLog;
 import com.goafanti.common.model.PatentLog;
 import com.goafanti.common.model.PatentRegistration;
 import com.goafanti.common.model.PatentRegistration;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.DownloadUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -53,6 +58,9 @@ import com.goafanti.techservice.patent.service.PatentLogService;
 import com.goafanti.techservice.patent.service.PatentRegistrationService;
 import com.goafanti.techservice.patent.service.PatentRegistrationService;
 import com.goafanti.user.service.OrganizationIdentityService;
 import com.goafanti.user.service.OrganizationIdentityService;
 
 
+
+
+
 @Controller
 @Controller
 @RequestMapping(value = "/techservice/patent")
 @RequestMapping(value = "/techservice/patent")
 public class PatentApiController extends BaseApiController {
 public class PatentApiController extends BaseApiController {
@@ -69,6 +77,9 @@ public class PatentApiController extends BaseApiController {
 	@Resource
 	@Resource
 	private AdminService				adminService;
 	private AdminService				adminService;
 	
 	
+	/*@Autowired
+	DownloadUtils downloadUtils;*/
+	
 	@Value(value = "${upload.private.path}")
 	@Value(value = "${upload.private.path}")
 	private String	uploadPrivatePath	= null;
 	private String	uploadPrivatePath	= null;
 
 
@@ -401,17 +412,255 @@ public class PatentApiController extends BaseApiController {
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 专利综合管理导出
+	 * 用户确认申报材料
+	 * @return
 	 */
 	 */
-	@RequestMapping(value="/exportComposite", method = RequestMethod.POST)
+	@RequestMapping(value= "clientConfirm",method = RequestMethod.POST)
+	public Result clientConfirmApplicationMaterials(String pid){
+		Result res = new Result();
+		PatentInfo p = new PatentInfo();
+		p.setId(pid);
+		p.setConfirmState(1);
+		res.setData(patentInfoService.updateByPrimaryKeySelective(p));
+		return res;
+	}
+	
+	/**
+	 * 专利综合管理报表导出
+	 * @throws ParseException 
+	 */
+	@RequestMapping(value = "/exportComposite", method = RequestMethod.POST)
 	public Result exportComposite(Integer serialNumber, String patentNumber, String office,
 	public Result exportComposite(Integer serialNumber, String patentNumber, String office,
 			String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
 			String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
-			String[] createTime, String[] patentApplicationDate, String author, HttpServletResponse response){
+			String[] createTime, String[] patentApplicationDate, String author, HttpServletResponse response) throws ParseException{
 		Result res =  new Result();
 		Result res =  new Result();
+		@SuppressWarnings("unchecked")
+		List<PatentCompositeBo> composites =(List<PatentCompositeBo>)getManagePatentList( serialNumber,  patentNumber,  office,
+				 locationProvince,  unitName,  patentCatagory,  patentName,  patentState,
+				 createTime,  patentApplicationDate,  author , 1 , 1000).getList();
+		if (res.getError().isEmpty()) {
+			exportComosites(response, composites);
+		} else {
+			DownloadUtils downloadUtils = new DownloadUtils();
+			downloadUtils.out(response, res.toString());
+		}
 		return res;
 		return res;
 	}
 	}
 	
 	
 	/**
 	/**
+	 * 待缴年登印费专利管理报表导出
+	 */
+	@RequestMapping(value = "/exportPending" , method = RequestMethod.GET)
+	public Result exportPending(String locationProvince ,HttpServletResponse response){
+		Result res = new Result();
+		@SuppressWarnings("unchecked")
+		List<PatentPendingBo> pendings =(List<PatentPendingBo>)getManagePendingPaymentList(locationProvince,1,1000).getList();
+		if (res.getError().isEmpty()) {
+			exportPendings(response, pendings);
+		} else {
+			DownloadUtils downloadUtils = new DownloadUtils();
+			downloadUtils.out(response, res.toString());
+		}
+		return res;
+	}
+	
+
+	/**
+	 * 专利申请费用管理报表导出
+	 * @throws ParseException 
+	 */
+	@RequestMapping(value="/exportApplicationFee",method = RequestMethod.GET)
+	public Result exportApplicationFee(@RequestParam(name = "patentApplicationDate[]", required = false) String[] patentApplicationDate,
+			String locationProvince,HttpServletResponse response) throws ParseException{
+		Result res = new Result();
+		@SuppressWarnings("unchecked")
+		List<PatentApplicationFeeBo> fees = (List<PatentApplicationFeeBo>)getApplicationFeeList(
+				 patentApplicationDate, locationProvince,1,1000).getList();
+		if (res.getError().isEmpty()) {
+			exportFees(response, fees);
+		} else {
+			DownloadUtils downloadUtils = new DownloadUtils();
+			downloadUtils.out(response, res.toString());
+		}	
+		
+		return res;
+	}
+	
+	//专利申请费用管理报表
+	private void exportFees(HttpServletResponse response, List<PatentApplicationFeeBo> fees) {
+		String sheetName = "专利申请费用管理报表";
+		HSSFWorkbook workbook  = createWorkbook(sheetName,
+				new String[]{"编号","申请号/专利号","省份","公司名称","专利名称","缴费状态","申请费","实审费","文印费","是否请款",
+						"是否报销","申请日","缴费截止时间"});
+		
+		HSSFSheet sheet = workbook.getSheet(sheetName);
+		
+		for(int i = 0 ;i < fees.size();i++){
+			PatentApplicationFeeBo obj = fees.get(i);
+			HSSFRow row = sheet.createRow(i + 2);// 创建所需的行数
+			if(null == obj.getSerialNumber()){
+				row.createCell(0).setCellValue("");
+			}else{
+				row.createCell(0).setCellValue(obj.getSerialNumber());
+			}
+			row.createCell(1).setCellValue(obj.getPatentNumber());
+			row.createCell(2).setCellValue(obj.getLocationProvince());
+			row.createCell(3).setCellValue(obj.getUnitName());
+			row.createCell(4).setCellValue(obj.getPatentName());
+			if(null != obj.getPaymentState()){
+				switch (obj.getPaymentState()){
+				case 0 :
+					row.createCell(5).setCellValue("未缴费");
+					break;
+				case 1 :
+					row.createCell(5).setCellValue("已缴费");
+				}
+			}else{
+				row.createCell(5).setCellValue("未缴费");
+			}
+			row.createCell(6).setCellValue(null == obj.getApplicationFee() ? 0 : obj.getApplicationFee());
+			row.createCell(7).setCellValue(null == obj.getTrialFee() ? 0 : obj.getTrialFee());
+			row.createCell(8).setCellValue(null == obj.getPrintingFee() ? 0 : obj.getPrintingFee());
+			
+			if(null != obj.getFunds()){
+				switch (obj.getFunds()){
+				case 0 :
+					row.createCell(9).setCellValue("否");
+					break;
+				case 1 :
+					row.createCell(9).setCellValue("是");
+				}
+			}else{
+				row.createCell(9).setCellValue("否");
+			}
+			
+			if(null != obj.getReimbursement()){
+				switch (obj.getReimbursement()){
+				case 0 :
+					row.createCell(10).setCellValue("否");
+					break;
+				case 1 :
+					row.createCell(10).setCellValue("是");
+				}
+			}else{
+				row.createCell(10).setCellValue("否");
+			}
+			
+			row.createCell(11).setCellValue(obj.getPatentApplicationDateFormattedDate());
+			row.createCell(12).setCellValue(null == obj.getPatentApplicationDateFormattedDate() ? "" : calDeadline(obj.getPatentApplicationDateFormattedDate()));
+			
+		}
+		DownloadUtils downloadUtils = new DownloadUtils();
+		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+	}
+    
+	//待缴年登印费专利管理报表
+	private void exportPendings(HttpServletResponse response, List<PatentPendingBo> pendings) {
+		String sheetName = "待缴年登印费专利管理报表";
+		HSSFWorkbook workbook  = createWorkbook(sheetName,
+				new String[]{"编号","申请号/专利号","省份","公司名称","专利类型","专利名称","专利状态","缴费状态","缴费截止日期"});
+		
+		HSSFSheet sheet = workbook.getSheet(sheetName);
+		
+		for(int i = 0 ;i < pendings.size();i++){
+			PatentPendingBo obj = pendings.get(i);
+			HSSFRow row = sheet.createRow(i + 2);// 创建所需的行数
+			if(null == obj.getSerialNumber()){
+				row.createCell(0).setCellValue("");
+			}else{
+				row.createCell(0).setCellValue(obj.getSerialNumber());
+			}
+			row.createCell(1).setCellValue(obj.getPatentNumber());
+			row.createCell(2).setCellValue(obj.getLocationProvince());
+			row.createCell(3).setCellValue(obj.getUnitName());
+			if(null != obj.getPatentCatagory()){
+				switch (obj.getPatentCatagory()){
+				 	case 0:
+				 		row.createCell(4).setCellValue("发明型专利");
+				 		break;
+				 	case 1:
+				 		row.createCell(4).setCellValue("科技型专利");
+				 		break;
+				 	case 2:
+				 		row.createCell(4).setCellValue("外观型专利");
+				 		break;
+				}
+			}else{
+				row.createCell(4).setCellValue("");
+			}
+			row.createCell(5).setCellValue(obj.getPatentName());
+			row.createCell(6).setCellValue(null == obj.getPatentState() ? "" : switchPatState(obj.getPatentState()));
+			if(null != obj.getAnnualFeeState()){
+				switch (obj.getAnnualFeeState()){
+				case 0 :
+					row.createCell(7).setCellValue("未缴费");
+					break;
+				case 1 :
+					row.createCell(7).setCellValue("已缴费");
+					break;
+				}
+			}else{
+				row.createCell(7).setCellValue("未缴费");
+			}
+			row.createCell(8).setCellValue(null == obj.getAuthorizedDateFormattedDate() ? "" : calDeadline(obj.getAuthorizedDateFormattedDate()));
+			DownloadUtils downloadUtils = new DownloadUtils();
+			downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+		}
+	}
+	
+
+	private void exportComosites(HttpServletResponse response, List<PatentCompositeBo> composites) {
+		String sheetName = "专利综合管理报表";
+		HSSFWorkbook workbook = createWorkbook(sheetName,
+				new String[] { "编号", "申请号/专利号", "事务所", "省份", "公司名称", "专利名称", "专利状态", "派单日" ,
+		"申请日" , "授权日" , "资料撰写人"});
+		HSSFSheet sheet = workbook.getSheet(sheetName);
+
+		// 将查询出的数据设置到sheet对应的单元格中
+		for (int i = 0; i < composites.size(); i++) {
+			PatentCompositeBo obj = composites.get(i);// 遍历每个对象
+			HSSFRow row = sheet.createRow(i + 2);// 创建所需的行数
+			if(null == obj.getSerialNumber()){
+				row.createCell(0).setCellValue("");
+			}else{
+				row.createCell(0).setCellValue(obj.getSerialNumber());
+			}
+			row.createCell(1).setCellValue(obj.getPatentNumber());
+			row.createCell(2).setCellValue(obj.getOffice());
+			row.createCell(3).setCellValue(obj.getLocationProvince());
+			row.createCell(4).setCellValue(obj.getUnitName());
+			row.createCell(5).setCellValue(obj.getPatentName());
+			row.createCell(6).setCellValue(null == obj.getPatentState()? "" : switchPatState(obj.getPatentState()));
+			row.createCell(7).setCellValue(null == obj.getPatentState() ? "" : switchPatState(obj.getPatentState()));
+			row.createCell(8).setCellValue(obj.getCreateTimeFormattedDate());
+			row.createCell(9).setCellValue(obj.getPatentApplicationFormattedDate());
+			row.createCell(10).setCellValue(obj.getPatentApplicationFormattedDate());
+			row.createCell(11).setCellValue(obj.getAuthor());
+		}
+		DownloadUtils downloadUtils = new DownloadUtils();
+		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+		
+	}
+	
+	private HSSFWorkbook createWorkbook(String sheetName, String[] colNames) {
+		HSSFWorkbook workbook = new HSSFWorkbook();
+		HSSFSheet sheet = workbook.createSheet(sheetName);
+		// 产生表格标题行
+		HSSFRow rowm = sheet.createRow(0);
+		HSSFCell cellTitle = rowm.createCell(0);
+		cellTitle.setCellValue(sheetName);
+		sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, (colNames.length - 1)));
+
+		HSSFRow rowRowName = sheet.createRow(1); // 在索引2的位置创建行(最顶端的行开始的第二行)
+
+		// 将列头设置到sheet的单元格中
+		for (int n = 0; n < colNames.length; n++) {
+			rowRowName.createCell(n).setCellValue(colNames[n]);
+		}
+		return workbook;
+	}
+
+	/**
 	 * 专利相关材料上传
 	 * 专利相关材料上传
 	 * @param req
 	 * @param req
 	 * @param sign 材料类型标记,其中'patent_prory_statement'为专利代理委托书标记
 	 * @param sign 材料类型标记,其中'patent_prory_statement'为专利代理委托书标记
@@ -443,7 +692,7 @@ public class PatentApiController extends BaseApiController {
 	@RequestMapping(value="/downloadTemplate",method = RequestMethod.GET)
 	@RequestMapping(value="/downloadTemplate",method = RequestMethod.GET)
 	public Result downloadPatentProryStatement(HttpServletResponse response,  HttpServletRequest request){
 	public Result downloadPatentProryStatement(HttpServletResponse response,  HttpServletRequest request){
 		Result res = new Result();
 		Result res = new Result();
-		String filename =Long.toString(System.nanoTime())+".doc"; 
+		String filename ="专利代理委托书模版" + Long.toString(System.nanoTime())+".doc"; 
 		String fileSaveRootPath = uploadPrivatePath + "/patent/patent_prory_statement.doc";
 		String fileSaveRootPath = uploadPrivatePath + "/patent/patent_prory_statement.doc";
 		return patentDownload(res,response,filename,fileSaveRootPath);
 		return patentDownload(res,response,filename,fileSaveRootPath);
 	}
 	}
@@ -459,10 +708,10 @@ public class PatentApiController extends BaseApiController {
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
 			return res;
 			return res;
 		}
 		}
-		if(null == TokenManager.getAdminToken()){
+		/*if(null == TokenManager.getAdminToken()){
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "权限不足,无法下载!"));	
 			res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "权限不足,无法下载!"));	
 			return res;
 			return res;
-		}
+		}*/
 		String filename = "";
 		String filename = "";
 		if(sign.equals("patent_prory_statement") || sign.equals("patent_writing")){
 		if(sign.equals("patent_prory_statement") || sign.equals("patent_writing")){
 		    filename =Long.toString(System.nanoTime())+".doc"; 
 		    filename =Long.toString(System.nanoTime())+".doc"; 
@@ -564,8 +813,8 @@ public class PatentApiController extends BaseApiController {
 	// 管理端申请专利列表(专利综合管理)
 	// 管理端申请专利列表(专利综合管理)
 	private Pagination<PatentCompositeBo> getManagePatentList(Integer serialNumber, String patentNumber, String office,
 	private Pagination<PatentCompositeBo> getManagePatentList(Integer serialNumber, String patentNumber, String office,
 			String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
 			String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
-			String[] createTime, String[] patentApplicationDate, String author, Integer pNo, Integer pSize)
-			throws ParseException {
+			String[] createTime, String[] patentApplicationDate, String author, Integer pNo, Integer pSize) throws ParseException
+			 {
 		return (Pagination<PatentCompositeBo>) patentInfoService.getManagePatentList(serialNumber, patentNumber, office,
 		return (Pagination<PatentCompositeBo>) patentInfoService.getManagePatentList(serialNumber, patentNumber, office,
 				locationProvince, unitName, patentCatagory, patentName, patentState, createTime, patentApplicationDate,
 				locationProvince, unitName, patentCatagory, patentName, patentState, createTime, patentApplicationDate,
 				author, pNo, pSize);
 				author, pNo, pSize);
@@ -627,6 +876,66 @@ public class PatentApiController extends BaseApiController {
 		patentRegistration.setPid(pid);
 		patentRegistration.setPid(pid);
 		return patentRegistration;
 		return patentRegistration;
 	}
 	}
+	
+	//缴费截止日期
+	private String calDeadline(String s){
+		String[] arr = s.split("-");
+		String y = arr[0];
+		String m = arr[1];
+		String d = arr[2];
+		if("11".equals(arr[0])){
+			m = "01";
+			y = String.valueOf(Integer.parseInt(y)+1);
+		}else if("12".equals(arr[0])){
+			m = "02";
+			y = String.valueOf(Integer.parseInt(y)+1);
+		}else{
+			m = String.valueOf(Integer.parseInt(m)+2);
+		}
+		return y + m + d;
+	}
+	
+	
+	//专利状态
+	private String switchPatState(Integer s){
+		String state = "";
+		switch  (s){
+		case 0:
+			state = "撤销";
+			break;
+		case 1:
+			state = "申请";
+		    break;
+		case 2:
+			state = "撰写";
+		    break;
+		case 3:
+			state = "受理";
+		    break;
+		case 4:
+			state = "审查意见通知";
+		    break;
+		case 5:
+			state = "审查意见已答复";
+		    break;
+		case 6:
+			state = "补正通知";
+		    break;
+		case 7:
+			state = "补正已答复";
+		    break;
+		case 8:
+			state = "授权";
+		    break;
+		case 9:
+			state = "驳回";
+		    break;
+		case 10:
+			state = "发证";
+		    break;
+		}
+		return state;
+	}
 
 
 
 
 }
 }

+ 107 - 106
src/main/resources/spring/spring-mvc.xml

@@ -1,107 +1,108 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:task="http://www.springframework.org/schema/task" xmlns:mvc="http://www.springframework.org/schema/mvc"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans 
-	http://www.springframework.org/schema/beans/spring-beans.xsd 
-	http://www.springframework.org/schema/context 
-	http://www.springframework.org/schema/context/spring-context-4.0.xsd 
-	http://www.springframework.org/schema/task
-	http://www.springframework.org/schema/task/spring-task-4.0.xsd
-	http://www.springframework.org/schema/mvc 
-	http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
-
-	<!-- Scan controller -->
-	<context:component-scan
-		base-package="com.goafanti.*.controller;com.goafanti.*.*.controller;com.goafanti.common.timer;com.goafanti.core.websocket" />
-
-	<bean name="springContextUtils" class="com.goafanti.common.utils.SpringContextUtils" scope="singleton"></bean>
-	
-	<bean id="passwordUtil" class="com.goafanti.common.utils.PasswordUtil">
-		<property name="algorithmName" value="${pwd.hash_algorithm_name}"/>  
-	    <property name="hashIterations" value="${pwd.hash_iterations}"/> 
-	</bean>
-	
-	<!-- spring bean validator -->
-	<bean id="validator"
-		class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
-		<property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
-		<property name="validationMessageSource" ref="messageSource" />
-	</bean>
-
-	<mvc:annotation-driven validator="validator" />
-
-	<bean
-		class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
-		<property name="securityManager" ref="securityManager" />
-	</bean>
-
-
-
-	<bean id="messageSource"
-		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
-		<property name="defaultEncoding" value="UTF-8"></property>
-		<property name="basenames">
-			<list>
-				<value>classpath:props/error</value>
-			</list>
-		</property>
-	</bean>
-
-
-	<!-- Handles HTTP GET requests for /assets/** by efficiently serving up 
-		static resources in the ${webappRoot}/assets directory -->
-	<mvc:resources mapping="/static/images/**" location="/WEB-INF/images/" />
-	<mvc:resources mapping="/static/html/**" location="/WEB-INF/html/" />
-	<mvc:resources mapping="/static/**" location="/WEB-INF/build/" />
-	<mvc:resources mapping="/favicon.ico" location="/WEB-INF/assets/favicon.ico" />
-	<mvc:resources mapping="/robots.txt" location="/WEB-INF/assets/robots.txt" />
-
-	<!-- Resolves views selected for rendering by @Controllers to .jsp resources 
-		in the /WEB-INF/views directory -->
-	<bean
-		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
-		<property name="viewClass"
-			value="org.springframework.web.servlet.view.JstlView" />
-		<property name="prefix" value="/WEB-INF/views/" />
-		<property name="suffix" value=".jsp" />
-	</bean>
-
-	<bean id="multipartResolver"
-		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
-		<property name="defaultEncoding" value="UTF-8" />
-		<property name="maxUploadSize" value="10485760" />
-	</bean>
-
-	<bean
-		class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
-	</bean>
-
-	<bean
-		class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
-		<property name="messageConverters">
-			<list>
-				<bean
-					class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
-			</list>
-		</property>
-	</bean>
-
-	<bean id="exceptionResolver" class="com.goafanti.common.error.SystemExceptionResolver">
-		<property name="exceptionMappings">
-			<props>
-				<prop key="org.apache.shiro.authc.UnknownAccountException">login</prop>
-				<prop key="org.apache.shiro.authc.LockedAccountException">login</prop>
-				<prop key="org.apache.shiro.authc.ExcessiveAttemptsException">login</prop>
-				<prop key="org.apache.shiro.authc.IncorrectCredentialsException">login</prop>
-				<prop key="org.apache.shiro.session.ExpiredSessionException">login</prop>
-				<prop key="java.lang.Exception">error</prop>
-			</props>
-		</property>
-	</bean>
-	<bean id="shiroFilterUtils" class="com.goafanti.core.shiro.filter.ShiroFilterUtils" scope="singleton">
-		<property name="appName" value="${app.name}" />
-	</bean>
-	<bean id="systemWebSocketHandler" class="com.goafanti.core.websocket.SystemWebSocketHandler" scope="singleton"></bean>
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:task="http://www.springframework.org/schema/task" xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans 
+	http://www.springframework.org/schema/beans/spring-beans.xsd 
+	http://www.springframework.org/schema/context 
+	http://www.springframework.org/schema/context/spring-context-4.0.xsd 
+	http://www.springframework.org/schema/task
+	http://www.springframework.org/schema/task/spring-task-4.0.xsd
+	http://www.springframework.org/schema/mvc 
+	http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
+
+	<!-- Scan controller -->
+		
+		<context:component-scan
+		base-package="com.goafanti.*.controller;com.goafanti.*.*.controller;com.goafanti.common.timer;com.goafanti.core.websocket" />
+
+	<bean name="springContextUtils" class="com.goafanti.common.utils.SpringContextUtils" scope="singleton"></bean>
+	
+	<bean id="passwordUtil" class="com.goafanti.common.utils.PasswordUtil">
+		<property name="algorithmName" value="${pwd.hash_algorithm_name}"/>  
+	    <property name="hashIterations" value="${pwd.hash_iterations}"/> 
+	</bean>
+	
+	<!-- spring bean validator -->
+	<bean id="validator"
+		class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
+		<property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
+		<property name="validationMessageSource" ref="messageSource" />
+	</bean>
+
+	<mvc:annotation-driven validator="validator" />
+
+	<bean
+		class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
+		<property name="securityManager" ref="securityManager" />
+	</bean>
+
+
+
+	<bean id="messageSource"
+		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
+		<property name="defaultEncoding" value="UTF-8"></property>
+		<property name="basenames">
+			<list>
+				<value>classpath:props/error</value>
+			</list>
+		</property>
+	</bean>
+
+
+	<!-- Handles HTTP GET requests for /assets/** by efficiently serving up 
+		static resources in the ${webappRoot}/assets directory -->
+	<mvc:resources mapping="/static/images/**" location="/WEB-INF/images/" />
+	<mvc:resources mapping="/static/html/**" location="/WEB-INF/html/" />
+	<mvc:resources mapping="/static/**" location="/WEB-INF/build/" />
+	<mvc:resources mapping="/favicon.ico" location="/WEB-INF/assets/favicon.ico" />
+	<mvc:resources mapping="/robots.txt" location="/WEB-INF/assets/robots.txt" />
+
+	<!-- Resolves views selected for rendering by @Controllers to .jsp resources 
+		in the /WEB-INF/views directory -->
+	<bean
+		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+		<property name="viewClass"
+			value="org.springframework.web.servlet.view.JstlView" />
+		<property name="prefix" value="/WEB-INF/views/" />
+		<property name="suffix" value=".jsp" />
+	</bean>
+
+	<bean id="multipartResolver"
+		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
+		<property name="defaultEncoding" value="UTF-8" />
+		<property name="maxUploadSize" value="10485760" />
+	</bean>
+
+	<bean
+		class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
+	</bean>
+
+	<bean
+		class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
+		<property name="messageConverters">
+			<list>
+				<bean
+					class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
+			</list>
+		</property>
+	</bean>
+
+	<bean id="exceptionResolver" class="com.goafanti.common.error.SystemExceptionResolver">
+		<property name="exceptionMappings">
+			<props>
+				<prop key="org.apache.shiro.authc.UnknownAccountException">login</prop>
+				<prop key="org.apache.shiro.authc.LockedAccountException">login</prop>
+				<prop key="org.apache.shiro.authc.ExcessiveAttemptsException">login</prop>
+				<prop key="org.apache.shiro.authc.IncorrectCredentialsException">login</prop>
+				<prop key="org.apache.shiro.session.ExpiredSessionException">login</prop>
+				<prop key="java.lang.Exception">error</prop>
+			</props>
+		</property>
+	</bean>
+	<bean id="shiroFilterUtils" class="com.goafanti.core.shiro.filter.ShiroFilterUtils" scope="singleton">
+		<property name="appName" value="${app.name}" />
+	</bean>
+	<bean id="systemWebSocketHandler" class="com.goafanti.core.websocket.SystemWebSocketHandler" scope="singleton"></bean>
 </beans>
 </beans>