albertshaw 8 years ago
parent
commit
1110e10452
1 changed files with 108 additions and 117 deletions
  1. 108 117
      src/main/java/com/goafanti/admin/controller/AdminPatentApiController.java

+ 108 - 117
src/main/java/com/goafanti/admin/controller/AdminPatentApiController.java

@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.alibaba.fastjson.JSON;
 import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
@@ -219,14 +220,15 @@ public class AdminPatentApiController extends CertifyApiController {
 				pSize));
 		return res;
 	}
-	
+
 	/**
 	 * 专利详情
+	 * 
 	 * @param pid
 	 * @return
 	 */
 	@RequestMapping(value = "/detail", method = RequestMethod.GET)
-	public Result patentDetail(String pid){
+	public Result patentDetail(String pid) {
 		Result res = new Result();
 		if (!checkAdminLogin(res)) {
 			return res;
@@ -379,7 +381,7 @@ public class AdminPatentApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/saveRecieveSend", method = RequestMethod.POST)
 	public Result recieveSendDetail(BindingResult bindingResult, String rid, String pid,
-			@Valid InputPatentRegistration patentRegistrationBo)  {
+			@Valid InputPatentRegistration patentRegistrationBo) {
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
@@ -398,8 +400,7 @@ public class AdminPatentApiController extends CertifyApiController {
 		patentRegistrationService.updateByPrimaryKey(regBo2Reg(rid, pid, patentRegistrationBo));
 		return res;
 	}
-	
-	
+
 	/**
 	 * 专利申请费用管理
 	 */
@@ -424,7 +425,7 @@ public class AdminPatentApiController extends CertifyApiController {
 	 * 登记申请费用
 	 */
 	@RequestMapping(value = "/registerApplicationFee", method = RequestMethod.POST)
-	public Result registerApplicationFee(@Valid InputPatentCost patentCost,BindingResult bindingResult, String cid) {
+	public Result registerApplicationFee(@Valid InputPatentCost patentCost, BindingResult bindingResult, String cid) {
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
@@ -434,19 +435,19 @@ public class AdminPatentApiController extends CertifyApiController {
 		if (!checkAdminLogin(res)) {
 			return res;
 		}
-		
-		if (null == cid){
+
+		if (null == cid) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "专利记录ID", "专利记录ID"));
 			return res;
 		}
-		
+
 		PatentCost pc = new PatentCost();
 		BeanUtils.copyProperties(patentCost, pc);
 		pc.setId(cid);
 		res.setData(patentCostService.updateByPrimaryKeySelective(pc));
 		return res;
 	}
-	
+
 	/**
 	 * 专利综合管理报表导出
 	 * 
@@ -472,8 +473,7 @@ public class AdminPatentApiController extends CertifyApiController {
 		if (res.getError().isEmpty()) {
 			exportComosites(response, composites);
 		} else {
-			FileUtils downloadUtils = new FileUtils();
-			downloadUtils.out(response, res.toString());
+			FileUtils.out(response, JSON.toJSONString(res));
 		}
 		return res;
 	}
@@ -490,8 +490,7 @@ public class AdminPatentApiController extends CertifyApiController {
 		if (res.getError().isEmpty()) {
 			exportPendings(response, pendings);
 		} else {
-			FileUtils downloadUtils = new FileUtils();
-			downloadUtils.out(response, res.toString());
+			FileUtils.out(response, JSON.toJSONString(res));
 		}
 		return res;
 	}
@@ -512,8 +511,7 @@ public class AdminPatentApiController extends CertifyApiController {
 		if (res.getError().isEmpty()) {
 			exportFees(response, fees);
 		} else {
-			FileUtils downloadUtils = new FileUtils();
-			downloadUtils.out(response, res.toString());
+			FileUtils.out(response, JSON.toJSONString(res));
 		}
 
 		return res;
@@ -583,8 +581,7 @@ public class AdminPatentApiController extends CertifyApiController {
 					: calDeadline(obj.getPatentApplicationDateFormattedDate()));
 
 		}
-		FileUtils downloadUtils = new FileUtils();
-		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+		FileUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 	}
 
 	// 待缴年登印费专利管理报表
@@ -639,8 +636,7 @@ public class AdminPatentApiController extends CertifyApiController {
 					: calDeadline(obj.getAuthorizedDateFormattedDate()));
 
 		}
-		FileUtils downloadUtils = new FileUtils();
-		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+		FileUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 	}
 
 	private void exportComosites(HttpServletResponse response, List<PatentCompositeBo> composites) {
@@ -670,8 +666,7 @@ public class AdminPatentApiController extends CertifyApiController {
 			row.createCell(10).setCellValue(obj.getPatentApplicationFormattedDate());
 			row.createCell(11).setCellValue(obj.getAuthor());
 		}
-		FileUtils downloadUtils = new FileUtils();
-		downloadUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
+		FileUtils.downloadExcel(response, sheetName + Calendar.getInstance().getTimeInMillis() + ".xls", workbook);
 
 	}
 
@@ -693,7 +688,6 @@ public class AdminPatentApiController extends CertifyApiController {
 		return workbook;
 	}
 
-
 	private PatentRegistration regBo2Reg(String rid, String pid, InputPatentRegistration patentRegistrationBo) {
 		PatentRegistration patentRegistration = new PatentRegistration();
 		patentRegistration.setId(rid);
@@ -745,100 +739,97 @@ public class AdminPatentApiController extends CertifyApiController {
 		patentRegistration.setPid(pid);
 		return patentRegistration;
 	}
-	
-
-		// 专利申请费用管理
-		private Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] patentApplicationDate,
-				String locationProvince, Integer pNo, Integer pSize) throws ParseException {
-			return patentCostService.getApplicationFeeList(patentApplicationDate, locationProvince, pNo, pSize);
-		}
-
-
-		// 待缴费专利管理
-		private Pagination<PatentPendingBo> getManagePendingPaymentList(String locationProvince, Integer pNo,
-				Integer pSize) {
-			return patentInfoService.getManagePendingPaymentList(locationProvince, pNo, pSize);
-		}
-
-		// 管理端申请专利列表(专利综合管理)
-		private Pagination<PatentManageListBo> 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 {
-			return patentInfoService.getManagePatentList(serialNumber, patentNumber, office, locationProvince, unitName,
-					patentCatagory, patentName, patentState, createTime, patentApplicationDate, author, pNo, pSize);
-		}
-
-		
-		// 缴费截止日期
-		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;
-			case 11:
-				state = "驳回";
-				break;
-			case 12:
-				state = "发证";
-				break;
-			case 13:
-				state = "已结款";
-				break;
-			case 14:
-				state = "撤销";
-				break;
-			}
-			return state;
+
+	// 专利申请费用管理
+	private Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] patentApplicationDate,
+			String locationProvince, Integer pNo, Integer pSize) throws ParseException {
+		return patentCostService.getApplicationFeeList(patentApplicationDate, locationProvince, pNo, pSize);
+	}
+
+	// 待缴费专利管理
+	private Pagination<PatentPendingBo> getManagePendingPaymentList(String locationProvince, Integer pNo,
+			Integer pSize) {
+		return patentInfoService.getManagePendingPaymentList(locationProvince, pNo, pSize);
+	}
+
+	// 管理端申请专利列表(专利综合管理)
+	private Pagination<PatentManageListBo> 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 {
+		return patentInfoService.getManagePatentList(serialNumber, patentNumber, office, locationProvince, unitName,
+				patentCatagory, patentName, patentState, createTime, patentApplicationDate, author, pNo, pSize);
+	}
+
+	// 缴费截止日期
+	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;
+		case 11:
+			state = "驳回";
+			break;
+		case 12:
+			state = "发证";
+			break;
+		case 13:
+			state = "已结款";
+			break;
+		case 14:
+			state = "撤销";
+			break;
+		}
+		return state;
+	}
 
 }