|
|
@@ -1,5 +1,6 @@
|
|
|
package com.goafanti.techservice.cognizance.controller;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
@@ -7,11 +8,13 @@ import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
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;
|
|
|
@@ -24,6 +27,7 @@ import com.goafanti.common.model.OrgRatepay;
|
|
|
import com.goafanti.common.model.OrgStandard;
|
|
|
import com.goafanti.common.model.OrgTechProduct;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
+import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.techservice.cognizance.bo.ActivityNumberBo;
|
|
|
@@ -529,6 +533,44 @@ public class CognizanceApiController extends BaseApiController {
|
|
|
res.setData(activityNumberBo);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 高企相关材料上传
|
|
|
+ * @param req
|
|
|
+ * @param sign
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/cognizance/upload", method = RequestMethod.POST)
|
|
|
+ public Result cognizanceFile(HttpServletRequest req, String sign, String uid) {
|
|
|
+ Result res = new Result();
|
|
|
+ res.setData(handleFile(res, "/cognizance/", true, req, sign, uid));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign, String uid) {
|
|
|
+ List<MultipartFile> files = getFiles(req);
|
|
|
+ String fileName = "";
|
|
|
+ if (StringUtils.isBlank(uid)){
|
|
|
+ fileName = path + TokenManager.getUserId() + "_" + sign + ".jpg";
|
|
|
+ } else {
|
|
|
+ fileName = path + uid + "_" + sign + ".jpg";
|
|
|
+ }
|
|
|
+ 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 Result checkCertify(Result res) {
|