|
|
@@ -6,7 +6,6 @@ import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.LinkedHashMap;
|
|
|
@@ -18,7 +17,12 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
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.stereotype.Controller;
|
|
|
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.PatentRegistration;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
+import com.goafanti.common.utils.DownloadUtils;
|
|
|
import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
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.user.service.OrganizationIdentityService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/techservice/patent")
|
|
|
public class PatentApiController extends BaseApiController {
|
|
|
@@ -69,6 +77,9 @@ public class PatentApiController extends BaseApiController {
|
|
|
@Resource
|
|
|
private AdminService adminService;
|
|
|
|
|
|
+ /*@Autowired
|
|
|
+ DownloadUtils downloadUtils;*/
|
|
|
+
|
|
|
@Value(value = "${upload.private.path}")
|
|
|
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,
|
|
|
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();
|
|
|
+ @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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 待缴年登印费专利管理报表导出
|
|
|
+ */
|
|
|
+ @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 sign 材料类型标记,其中'patent_prory_statement'为专利代理委托书标记
|
|
|
@@ -443,7 +692,7 @@ public class PatentApiController extends BaseApiController {
|
|
|
@RequestMapping(value="/downloadTemplate",method = RequestMethod.GET)
|
|
|
public Result downloadPatentProryStatement(HttpServletResponse response, HttpServletRequest request){
|
|
|
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";
|
|
|
return patentDownload(res,response,filename,fileSaveRootPath);
|
|
|
}
|
|
|
@@ -459,10 +708,10 @@ public class PatentApiController extends BaseApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "下载文件不存在!"));
|
|
|
return res;
|
|
|
}
|
|
|
- if(null == TokenManager.getAdminToken()){
|
|
|
+ /*if(null == TokenManager.getAdminToken()){
|
|
|
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";
|
|
|
@@ -564,8 +813,8 @@ public class PatentApiController extends BaseApiController {
|
|
|
// 管理端申请专利列表(专利综合管理)
|
|
|
private Pagination<PatentCompositeBo> getManagePatentList(Integer serialNumber, String patentNumber, String office,
|
|
|
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,
|
|
|
locationProvince, unitName, patentCatagory, patentName, patentState, createTime, patentApplicationDate,
|
|
|
author, pNo, pSize);
|
|
|
@@ -627,6 +876,66 @@ public class PatentApiController extends BaseApiController {
|
|
|
patentRegistration.setPid(pid);
|
|
|
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;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|