|
|
@@ -5,6 +5,7 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -12,10 +13,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import com.goafanti.admin.service.AttachmentService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AttachmentType;
|
|
|
+import com.goafanti.common.model.Attachment;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.common.utils.excel.NewExcelUtil;
|
|
|
import com.goafanti.patent.bo.PatentNewBo;
|
|
|
@@ -28,6 +32,8 @@ public class AdminPatentNewApiController extends CertifyApiController {
|
|
|
|
|
|
@Resource
|
|
|
private PatentNewService patentNewService;
|
|
|
+ @Resource
|
|
|
+ private AttachmentService attachmentService;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -116,7 +122,7 @@ public class AdminPatentNewApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 专利列表
|
|
|
+ * 导出专利列表
|
|
|
*/
|
|
|
@RequestMapping(value = "/export", method = RequestMethod.GET)
|
|
|
public Result export(PatentNewBo p,Integer pageSize,Integer pageNo){
|
|
|
@@ -125,6 +131,30 @@ public class AdminPatentNewApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 导出专利列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/exportMode", method = RequestMethod.GET)
|
|
|
+ public Result export(HttpServletResponse response, String sign){
|
|
|
+ Result res = new Result();
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+ if (attachmentType == AttachmentType.NEW_PATENT_TEMPLATE) {
|
|
|
+ String fileName = "";
|
|
|
+ Attachment af = attachmentService.selectByReceivbles(sign);
|
|
|
+ if (null == af) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
|
|
|
+ } else {
|
|
|
+ String path = af.getFilePath();
|
|
|
+ String suffix = path.substring(path.lastIndexOf("."));
|
|
|
+ fileName = AttachmentType.RECEIVABLES_TEMPLATE.getDesc() + suffix;
|
|
|
+ downloadFile(response, fileName, path);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Excel批量导入专利
|
|
|
*
|
|
|
* @param response
|