|
@@ -1,5 +1,6 @@
|
|
|
package com.goafanti.admin.controller;
|
|
package com.goafanti.admin.controller;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
@@ -9,16 +10,20 @@ import java.util.Map;
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
+import com.goafanti.admin.service.AftFileService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
|
|
+import com.goafanti.common.model.AftFile;
|
|
|
import com.goafanti.common.model.OrgActivity;
|
|
import com.goafanti.common.model.OrgActivity;
|
|
|
import com.goafanti.common.model.OrgActivityCost;
|
|
import com.goafanti.common.model.OrgActivityCost;
|
|
|
import com.goafanti.common.model.OrgAnnualReport;
|
|
import com.goafanti.common.model.OrgAnnualReport;
|
|
@@ -37,6 +42,7 @@ import com.goafanti.common.model.OrganizationIdentity;
|
|
|
import com.goafanti.common.model.UserAbility;
|
|
import com.goafanti.common.model.UserAbility;
|
|
|
import com.goafanti.common.model.UserIdentity;
|
|
import com.goafanti.common.model.UserIdentity;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
|
|
+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;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
@@ -109,6 +115,8 @@ public class AdminApiController extends BaseApiController {
|
|
|
private UserAbilityService userAbilityService;
|
|
private UserAbilityService userAbilityService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private OrgAnnualReportService orgAnnualReportService;
|
|
private OrgAnnualReportService orgAnnualReportService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private AftFileService aftFileService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 个人用户列表
|
|
* 个人用户列表
|
|
@@ -925,6 +933,7 @@ public class AdminApiController extends BaseApiController {
|
|
|
cog.setConsultant(null == log.getOperator() ? "" : log.getOperator());
|
|
cog.setConsultant(null == log.getOperator() ? "" : log.getOperator());
|
|
|
log.setId(UUID.randomUUID().toString());
|
|
log.setId(UUID.randomUUID().toString());
|
|
|
log.setCid(cog.getId());
|
|
log.setCid(cog.getId());
|
|
|
|
|
+ log.setOperator(TokenManager.getAdminId());
|
|
|
if (!StringUtils.isBlank(recordTimeFormattedDate)) {
|
|
if (!StringUtils.isBlank(recordTimeFormattedDate)) {
|
|
|
log.setRecordTime(DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd"));
|
|
log.setRecordTime(DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd"));
|
|
|
}
|
|
}
|
|
@@ -1036,6 +1045,40 @@ public class AdminApiController extends BaseApiController {
|
|
|
}
|
|
}
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传专利代理委托书模版
|
|
|
|
|
+ * @param req
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(value = "/uploadPatentTemplate", method = RequestMethod.POST)
|
|
|
|
|
+ public Result uploadPatentTemplate(HttpServletRequest req){
|
|
|
|
|
+ Result res = new Result();
|
|
|
|
|
+ List<MultipartFile> files = getFiles(req);
|
|
|
|
|
+ MultipartFile mf = files.get(0);
|
|
|
|
|
+ String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
|
|
|
|
|
+ if (suffix.equals("doc") || suffix.equals("doxc")){
|
|
|
|
|
+ String fileName = "patent_prory_statement" + suffix;
|
|
|
|
|
+ res.setData(handleFile(res, req, fileName, files, mf));
|
|
|
|
|
+ if (res.getData() != ""){
|
|
|
|
|
+ AftFile f = new AftFile();
|
|
|
|
|
+ f.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ f.setFileName("专利代理委托书模版");
|
|
|
|
|
+ f.setSign("patent_prory_statement");
|
|
|
|
|
+ f.setFilePath("/admin/" + fileName);
|
|
|
|
|
+ f.setDeleletedSign(0);
|
|
|
|
|
+ aftFileService.insert(f);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_PATTERN_ERROR, "文件格式错误,请重新上传!"));
|
|
|
|
|
+ }
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
// 判断用户是否通过认证
|
|
// 判断用户是否通过认证
|
|
|
private Result checkCertify(Result res, String uid) {
|
|
private Result checkCertify(Result res, String uid) {
|
|
@@ -1156,5 +1199,22 @@ public class AdminApiController extends BaseApiController {
|
|
|
|
|
|
|
|
return report;
|
|
return report;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private String handleFile(Result res, HttpServletRequest req, String fileName,List<MultipartFile> files, MultipartFile mf) {
|
|
|
|
|
+ if (!files.isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ mf.transferTo(toAdminPrivateFile(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;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|