| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028 |
- 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;
- import java.util.LinkedHashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.UUID;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- 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.Value;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.multipart.MultipartFile;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.BaseApiController;
- import com.goafanti.common.model.Admin;
- import com.goafanti.common.model.OrganizationIdentity;
- import com.goafanti.common.model.PatentCost;
- 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;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.techservice.patent.bo.PatentApplicationFeeBo;
- import com.goafanti.techservice.patent.bo.PatentCompositeBo;
- import com.goafanti.techservice.patent.bo.PatentNoticeOfCorrectionBo;
- import com.goafanti.techservice.patent.bo.PatentPendingBo;
- import com.goafanti.techservice.patent.bo.PatentRecieveSendBo;
- import com.goafanti.techservice.patent.bo.PatentRegistrationBo;
- import com.goafanti.techservice.patent.service.AdminService;
- import com.goafanti.techservice.patent.service.PatentCostService;
- import com.goafanti.techservice.patent.service.PatentInfoService;
- 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 {
- @Resource
- private PatentInfoService patentInfoService;
- @Resource
- private PatentLogService patentLogService;
- @Resource
- private OrganizationIdentityService organizationIdentityServivce;
- @Resource
- private PatentCostService patentCostService;
- @Resource
- private PatentRegistrationService patentRegistrationService;
- @Resource
- private AdminService adminService;
-
- /*@Autowired
- DownloadUtils downloadUtils;*/
-
- @Value(value = "${upload.private.path}")
- private String uploadPrivatePath = null;
- /**
- * 用户端专利申请
- */
- @RequestMapping(value = "/clientApplyPatent", method = RequestMethod.POST)
- public Result clientApplyPatent(PatentInfo patentInfo) {
- Result res = new Result();
- patentInfo.setId(UUID.randomUUID().toString());
- patentInfo.setUid(TokenManager.getUserId());
- patentInfoService.insert(patentInfo);
- PatentRegistration patentRegistration = new PatentRegistration();
- patentRegistration.setId(UUID.randomUUID().toString());
- patentRegistration.setPid(patentInfo.getId());
- patentRegistrationService.insert(patentRegistration);
- PatentCost patentCost = new PatentCost();
- patentCost.setId(UUID.randomUUID().toString());
- patentCost.setPid(patentInfo.getId());
- patentCost.setAnnualFeeState(0);
- patentCost.setPaymentState(0);
- patentCostService.insert(patentCost);
- res.setData(patentInfo);
- return res;
- }
- /**
- * 用户端专利详情
- *
- */
- @RequestMapping(value = "/clientPatentInfo", method = RequestMethod.POST)
- public Result clientPatentInfo(String patentId) {
- Result res = new Result();
- res.setData(patentInfoService.selectByPrimaryKey(patentId));
- return res;
- }
- /**
- * 用户端申请专利列表
- */
- @RequestMapping(value = "/clientApplyList", method = RequestMethod.POST)
- public Result clientApplyList(String patentNumber, String patentName, Integer patentCatagory, Integer patentState,
- String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getClientApplyList(res, patentNumber, patentName, patentCatagory, patentState, pNo, pSize));
- return res;
- }
-
- /**
- * 用户端录入知识产权信息(专利)
- * @return
- */
- @RequestMapping(value="/clientInputPatent", method = RequestMethod.POST)
- public Result clientInputPatent(String patentNumber, String patentName, Integer patentCatagory, Integer obtailWay,
- Integer sortNumber,String authorizationNumber, String authorizationDate){
- Result res = new Result();
- PatentInfo patent = new PatentInfo();
- patent.setId(UUID.randomUUID().toString());
- patent.setUid(TokenManager.getUserId());
- patent.setPatentName(patentName);
- patent.setPatentNumber(patentNumber);;
- patent.setPatentCatagory(patentCatagory);
- try {
- patent.setAuthorizedDate(DateUtils.parseDate(authorizationDate, "yyyy-MM-dd"));
- } catch (ParseException e) {
- res.getError().add(buildError("", "日期格式不正确"));
- }
- res.setData(patentInfoService.insert(patent));
- return res;
- }
-
- /**
- * 管理端录入知识产权信息(专利)
- * @param patentNumber
- * @param patentName
- * @param patentCatagory
- * @param obtailWay
- * @param sortNumber
- * @param authorizationNumber
- * @param authorizationDate
- * @param uid
- * @return
- */
- @RequestMapping(value="/managerInputPatent", method = RequestMethod.POST)
- public Result managerInputPatent(String patentNumber, String patentName, Integer patentCatagory, Integer obtailWay,
- Integer sortNumber,String authorizationNumber, String authorizationDate, String uid){
- Result res = new Result();
- PatentInfo patent = new PatentInfo();
- patent.setId(UUID.randomUUID().toString());
- patent.setUid(uid);
- patent.setPatentName(patentName);
- patent.setPatentNumber(patentNumber);;
- patent.setPatentCatagory(patentCatagory);
- try {
- patent.setAuthorizedDate(DateUtils.parseDate(authorizationDate, "yyyy-MM-dd"));
- } catch (ParseException e) {
- res.getError().add(buildError("", "日期格式不正确"));
- }
- res.setData(patentInfoService.insert(patent));
- return res;
- }
-
-
- /**
- * 用户端申请专利当前流程/管理端专利详情-专利状态流转记录
- */
- @RequestMapping(value = "/patentProcess", method = RequestMethod.POST)
- public Result patentProcess(String pid) {
- Result res = new Result();
- List<PatentLog> patentLog = patentLogService.selectProcessByPid(pid);
- res.setData(patentLog);
- return res;
- }
- /**
- * 管理端申请专利列表
- *
- * @throws ParseException
- */
- @RequestMapping(value = "/managePatentList", method = RequestMethod.POST)
- public Result managePatentList(Integer serialNumber, String patentNumber, String office, String locationProvince,
- String unitName, Integer patentCatagory, String patentName, Integer patentState,
- @RequestParam(name = "createTime[]", required = false) String[] createTime,
- @RequestParam(name = "patentApplicationDate[]", required = false) String[] patentApplicationDate,
- String author, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getManagePatentList(serialNumber, patentNumber, office, locationProvince, unitName, patentCatagory,
- patentName, patentState, createTime, patentApplicationDate, author, pNo, pSize));
- return res;
- }
- /**
- * 获取公司
- */
- @RequestMapping(value = "/getUnitNames", method = RequestMethod.GET)
- public Result getUnitNames() {
- Result res = new Result();
- List<OrganizationIdentity> list = organizationIdentityServivce.selectAllOrgIndentity();
- Map<String, String> map = new LinkedHashMap<String, String>();
- for (OrganizationIdentity o : list) {
- map.put(o.getUid(), o.getUnitName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 获取管理员
- */
- @RequestMapping(value = "/getAdmin", method = RequestMethod.GET)
- public Result getAdmin() {
- Result res = new Result();
- List<Admin> admin = adminService.selectAllAdmin();
- Map<String, String> map = new LinkedHashMap<String, String>();
- for (Admin a : admin) {
- map.put(a.getId(), a.getName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 管理端新增专利申请
- */
- @RequestMapping(value = "/manageApplyPatent", method = RequestMethod.POST)
- public Result manageApplyPatent(PatentInfo patentInfo, String uid) {
- Result res = new Result();
- if (null == uid) {
- res.getError().add(buildError("该公司无法提交申请!"));
- return res;
- }
- patentInfo.setId(UUID.randomUUID().toString());
- patentInfo.setUid(uid);
- patentInfoService.insert(patentInfo);
- PatentRegistration patentRegistration = new PatentRegistration();
- patentRegistration.setId(UUID.randomUUID().toString());
- patentRegistration.setPid(patentInfo.getId());
- patentRegistrationService.insert(patentRegistration);
- PatentCost patentCost = new PatentCost();
- patentCost.setId(UUID.randomUUID().toString());
- patentCost.setPid(patentInfo.getId());
- patentCost.setAnnualFeeState(0);
- patentCost.setPaymentState(0);
- patentCostService.insert(patentCost);
- res.setData(patentInfo);
- return res;
- }
- /**
- * 管理端专利详情修改保存
- */
- @RequestMapping(value = "/managePatentInfo", method = RequestMethod.POST)
- public Result managePatentInfo(String patentNumber,String patentName,String patentCatagory,String patentField,
- String patentDes,String patentWritingUrl,String authorizationNoticeUrl,String patentCertificateUrl,
- String xid, PatentLog patentLog ,String recordTimeFormattedDate) {
- Result res = new Result();
- PatentInfo patentInfo = new PatentInfo();
- patentInfo.setId(xid);
- patentInfo.setPatentNumber(patentNumber);
- patentInfo.setPatentCatagory(StringUtils.isNumeric(patentCatagory)?Integer.parseInt(patentCatagory):null);
- patentInfo.setPatentField(StringUtils.isNumeric(patentField)?Integer.parseInt(patentField):null);;
- patentInfo.setPatentDes(patentDes);
- patentInfo.setPatentWritingUrl(patentWritingUrl);
- patentInfo.setAuthorizationNoticeUrl(authorizationNoticeUrl);
- patentInfo.setPatentCertificateUrl(patentCertificateUrl);
- Date d ;
- if (!StringUtils.isBlank(recordTimeFormattedDate)) {
- try {
- d = DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd");
- } catch (ParseException e) {
- res.getError().add(buildError(ErrorConstants.PARAM_PATTERN_ERROR, "参数格式不正确", "yyyy-MM-dd"));
- return res;
- }
- }else{
- d = null;
- }
-
- if (!StringUtils.isBlank(patentLog.getPrincipal())) {
- switch (patentLog.getState()) {
- case 1:
- patentInfo.setCreateTime(d);
- break;
- case 3:
- patentInfo.setPatentApplicationDate(d);
- break;
- case 8:
- patentInfo.setAuthorizedDate(d);
- break;
- }
- patentInfo.setPatentState(patentLog.getState());
- patentLog.setPid(xid);
- patentLog.setId(UUID.randomUUID().toString());
- patentLog.setRecordTime(d);
- patentLog.setOperator(TokenManager.getAdminId());
- patentLogService.insert(patentLog);
- }
- patentInfo.setId(xid);
- patentInfoService.updateByPrimaryKeySelective(patentInfo);
- return res;
- }
- /**
- * 待缴费专利管理
- */
- @RequestMapping(value = "/managePendingPaymentList", method = RequestMethod.POST)
- public Result managePendingPaymentList(String locationProvince, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getManagePendingPaymentList(locationProvince, pNo, pSize));
- return res;
- }
- /**
- * 年费确认缴费
- */
- @RequestMapping(value = "/confirmPayment", method = RequestMethod.POST)
- public Result confirmPayment(String cid) {
- Result res = new Result();
- if (null == cid) {
- res.getError().add(buildError("确认缴费失败!"));
- return res;
- }
- PatentCost patentCost = new PatentCost();
- patentCost.setId(cid);
- patentCost.setAnnualFeeState(1);
- patentCostService.updateByPrimaryKeySelective(patentCost);
- return res;
- }
- /**
- * 补正审查通知列表
- */
- @RequestMapping(value = "/noticeOfCorrectionList", method = RequestMethod.POST)
- public Result noticeOfCorrectionList(Date authorizedDate, Integer serialNumber, String patentNumber, String office,
- String locationProvince, String unitName, Integer patentCatagory, String patentName, Integer patentState,
- String author, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getNoticeOfCorrectionList(authorizedDate, serialNumber, patentNumber, office, locationProvince,
- unitName, patentCatagory, patentName, patentState, author, pNo, pSize));
- return res;
- }
- /**
- * 补正审查通知答复确认
- */
- @RequestMapping(value = "/replyConfirm", method = RequestMethod.POST)
- public Result replyConfirm(String pid, Integer patentState) {
- Result res = new Result();
- PatentInfo patentInfo = new PatentInfo();
- patentInfo.setId(pid);
- if (patentState == 4) {
- patentInfo.setPatentState(5);
- } else if (patentState == 6) {
- patentInfo.setPatentState(7);
- } else {
- res.getError().add(buildError("通知答复确认失败!"));
- return res;
- }
- patentInfoService.updateByPrimaryKeySelective(patentInfo);
- PatentLog patentLog = new PatentLog();
- PatentInfo p = patentInfoService.selectByPrimaryKey(pid);
- patentLog.setId(UUID.randomUUID().toString());
- patentLog.setPid(pid);
- patentLog.setState(p.getPatentState());
- patentLog.setOperator(TokenManager.getAdminToken().getId());
- patentLog.setPrincipal(p.getPrincipal());
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- patentLog.setRecordTime(now.getTime());
- patentLogService.insert(patentLog);
- return res;
- }
- /**
- * 收发详情入口/收发纸件登记
- */
- @RequestMapping(value = "/getRecieveSendList", method = RequestMethod.POST)
- public Result RecieveSendList(String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getRecieveSendList(pNo, pSize));
- return res;
- }
- /**
- * 收发登记详情编辑保存
- *
- * @throws ParseException
- */
- @RequestMapping(value = "/saveRecieveSend", method = RequestMethod.POST)
- public Result recieveSendDetail(String rid, String pid ,PatentRegistrationBo patentRegistrationBo) throws ParseException {
- Result res = new Result();
- patentRegistrationService.updateByPrimaryKey(regBo2Reg(rid, pid, patentRegistrationBo));
- return res;
- }
- /**
- * 专利申请费用管理
- */
- @RequestMapping(value = "/getApplicationFeeList", method = RequestMethod.POST)
- public Result getApplicationFeeList(
- @RequestParam(name = "patentApplicationDate[]", required = false) String[] patentApplicationDate,
- String locationProvince, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getApplicationFeeList(patentApplicationDate, locationProvince, pNo, pSize));
- return res;
- }
- /**
- * 登记申请费用
- */
- @RequestMapping(value = "/registerApplicationFee", method = RequestMethod.POST)
- public Result registerApplicationFee(PatentCost patentCost, String cid) {
- Result res = new Result();
- PatentCost p = new PatentCost();
- p.setId(cid);
- p.setApplicationFee(patentCost.getApplicationFee());
- p.setReimbursement(patentCost.getReimbursement());
- p.setFunds(patentCost.getFunds());
- p.setTrialFee(patentCost.getTrialFee());
- p.setPrintingFee(patentCost.getPrintingFee());
- p.setPaymentState(patentCost.getPaymentState());
- res.setData(patentCostService.updateByPrimaryKeySelective(p));
- return res;
- }
-
- /**
- * 用户确认申报材料
- * @return
- */
- @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.GET)
- public Result exportComposite(@RequestParam(name = "serialNumber", required = false) String serialNumber, String patentNumber, String office,
- String locationProvince, String unitName, @RequestParam(name = "patentCatagory", required = false) String patentCatagory, String patentName, @RequestParam(name = "patentState", required = false) String patentState,
- @RequestParam(name = "createTime[]", required = false) String[] createTime, @RequestParam(name = "patentApplicationDate[]", required = false) String[] patentApplicationDate,
- String author, HttpServletResponse response) throws ParseException{
- Result res = new Result();
-
- Integer sn = (!StringUtils.isNumeric(serialNumber)? null : Integer.parseInt(serialNumber));
- Integer pc = (!StringUtils.isNumeric(patentCatagory)? null :Integer.parseInt(patentCatagory));
- Integer ps = (!StringUtils.isNumeric(patentState)? null : Integer.parseInt(patentState));
- String lp = ("undefined".equals(locationProvince)) ? null : locationProvince;
- @SuppressWarnings("unchecked")
- List<PatentCompositeBo> composites =(List<PatentCompositeBo>)getManagePatentList( sn, patentNumber, office,
- lp, unitName, pc, patentName, ps,
- 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'为专利代理委托书标记
- * @return
- */
- @RequestMapping(value="/patentFile",method = RequestMethod.POST)
- public Result patentFile(HttpServletRequest req ,String sign ,String oid) {
- Result res = new Result();
- String fileName = "";
- if (StringUtils.isBlank(oid)){
- fileName = "/patent/" + TokenManager.getUserId()+ "_" + sign + ".doc";
- } else {
- if (sign.equals("patent_prory_statement") || sign.equals("patent_writing")){
- fileName = "/patent/" + oid + "_" + sign + ".doc";
- } else {
- fileName = "/patent/" + oid + "_" + sign + ".jpg";
- }
- }
- res.setData(handleFile(res, fileName , req));
- return res;
- }
-
-
-
- /**
- * 下载专利代理委托书模版(用户端及管理端)
- * @return
- */
- @RequestMapping(value="/downloadTemplate",method = RequestMethod.GET)
- public Result downloadPatentProryStatement(HttpServletResponse response, HttpServletRequest request){
- 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);
- }
-
- /**
- * 下载专利相关材料
- * @return
- */
- @RequestMapping(value="/downloadFile",method = RequestMethod.GET)
- public Result downloadPatentFile(HttpServletResponse response, String path , String sign ,HttpServletRequest request){
- 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);
-
- }
-
- private Result patentDownload(Result res,HttpServletResponse response,String filename,String fileSaveRootPath){
- 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;
-
- }
-
- private String handleFile(Result res, String fileName, HttpServletRequest req) {
- List<MultipartFile> files = getFiles(req);
- if (!files.isEmpty()) {
- try {
- MultipartFile mf = files.get(0);
- mf.transferTo(toPrivateFile(fileName));
- LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
- } catch (IllegalStateException | IOException e) {
- LoggerUtils.error(getClass(), "文件上传失败", e);
- res.getError().add(buildError("", "文件上传失败!"));
- return "";
- }
- } else {
- res.getError().add(buildError("", "文件上传失败!"));
- return "";
- }
- return fileName;
- }
-
-
-
-
- // 专利纸件收发登记
- private Pagination<PatentRecieveSendBo> getRecieveSendList(Integer pNo, Integer pSize) {
- return (Pagination<PatentRecieveSendBo>) patentRegistrationService.getRecieveSendList(pNo, pSize);
- }
- // 专利申请费用管理
- private Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] patentApplicationDate,
- String locationProvince, Integer pNo, Integer pSize) throws ParseException {
- return (Pagination<PatentApplicationFeeBo>) patentCostService.getApplicationFeeList(patentApplicationDate,
- locationProvince, pNo, pSize);
- }
- // 补正审查通知列表
- private Pagination<PatentNoticeOfCorrectionBo> getNoticeOfCorrectionList(Date authorizedDate, Integer serialNumber,
- String patentNumber, String office, String locationProvince, String unitName, Integer patentCatagory,
- String patentName, Integer patentState, String author, Integer pNo, Integer pSize) {
- return (Pagination<PatentNoticeOfCorrectionBo>) patentInfoService.getNoticeOfCorrectionList(authorizedDate,
- serialNumber, patentNumber, office, locationProvince, unitName, patentCatagory, patentName, patentState,
- author, pNo, pSize);
- }
- // 待缴费专利管理
- private Pagination<PatentPendingBo> getManagePendingPaymentList(String locationProvince, Integer pNo,
- Integer pSize) {
- return (Pagination<PatentPendingBo>) patentInfoService.getManagePendingPaymentList(locationProvince, pNo,
- pSize);
- }
- // 管理端申请专利列表(专利综合管理)
- 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
- {
- return (Pagination<PatentCompositeBo>) patentInfoService.getManagePatentList(serialNumber, patentNumber, office,
- locationProvince, unitName, patentCatagory, patentName, patentState, createTime, patentApplicationDate,
- author, pNo, pSize);
- }
- // 用户端申请专利列表
- private Pagination<PatentInfo> getClientApplyList(Result res, String patentNumber, String patentName,
- Integer patentCatagory, Integer patentState, Integer pNo, Integer pSize) {
- return (Pagination<PatentInfo>) patentInfoService.getClientApplyList(TokenManager.getUserId(), patentNumber,
- patentName, patentCatagory, patentState, pNo, pSize);
- }
- private PatentRegistration regBo2Reg(String rid, String pid ,PatentRegistrationBo patentRegistrationBo) throws ParseException {
- PatentRegistration patentRegistration = new PatentRegistration();
- patentRegistration.setId(rid);
- patentRegistration.setAcceptanceExpressCompany(patentRegistrationBo.getAcceptanceExpressCompany());
- if (!StringUtils.isBlank(patentRegistrationBo.getAcceptanceIssueTime())) {
- patentRegistration.setAcceptanceIssueTime(
- DateUtils.parseDate(patentRegistrationBo.getAcceptanceIssueTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setAcceptanceIssueTime(null);
- }
- if (!StringUtils.isBlank(patentRegistrationBo.getAcceptanceReceiveTime())) {
- patentRegistration.setAcceptanceReceiveTime(
- DateUtils.parseDate(patentRegistrationBo.getAcceptanceReceiveTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setAcceptanceReceiveTime(null);
- }
- patentRegistration.setAcceptanceTrackingNumber(patentRegistrationBo.getAcceptanceTrackingNumber());
- patentRegistration.setAuthorizationExpressCompany(patentRegistrationBo.getAuthorizationExpressCompany());
- if (!StringUtils.isBlank(patentRegistrationBo.getAuthorizationIssueTime())) {
- patentRegistration.setAuthorizationIssueTime(
- DateUtils.parseDate(patentRegistrationBo.getAuthorizationIssueTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setAuthorizationIssueTime(null);
- }
- if (!StringUtils.isBlank(patentRegistrationBo.getAuthorizationReceiveTime())) {
- patentRegistration.setAuthorizationReceiveTime(
- DateUtils.parseDate(patentRegistrationBo.getAuthorizationReceiveTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setAuthorizationReceiveTime(null);
- }
- patentRegistration.setAuthorizationTrackingNumber(patentRegistrationBo.getAuthorizationTrackingNumber());
- patentRegistration.setCertificateExpressCompany(patentRegistrationBo.getCertificateExpressCompany());
- if (!StringUtils.isBlank(patentRegistrationBo.getCertificateIssueTime())) {
- patentRegistration.setCertificateIssueTime(
- DateUtils.parseDate(patentRegistrationBo.getCertificateIssueTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setCertificateIssueTime(null);
- }
- if (!StringUtils.isBlank(patentRegistrationBo.getCertificateRecieveTime())) {
- patentRegistration.setCertificateRecieveTime(
- DateUtils.parseDate(patentRegistrationBo.getCertificateRecieveTime(), "yyyy-MM-dd"));
- } else {
- patentRegistration.setCertificateRecieveTime(null);
- }
- patentRegistration.setCertificateTrackingNumber(patentRegistrationBo.getCertificateTrackingNumber());
- 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;
- }
-
- }
|