|
|
@@ -11,14 +11,40 @@ import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
|
|
+import com.goafanti.cognizance.service.OrgActivityCostService;
|
|
|
+import com.goafanti.cognizance.service.OrgActivityService;
|
|
|
+import com.goafanti.cognizance.service.OrgFinanceService;
|
|
|
+import com.goafanti.cognizance.service.OrgHonorDatumService;
|
|
|
+import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
|
|
|
+import com.goafanti.cognizance.service.OrgRatepayService;
|
|
|
+import com.goafanti.cognizance.service.OrgStandardService;
|
|
|
+import com.goafanti.cognizance.service.OrgTechAchievementService;
|
|
|
+import com.goafanti.cognizance.service.OrgTechCenterDetailService;
|
|
|
+import com.goafanti.cognizance.service.OrgTechProductService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.enums.AttachmentType;
|
|
|
+import com.goafanti.common.model.OrgActivity;
|
|
|
+import com.goafanti.common.model.OrgActivityCost;
|
|
|
+import com.goafanti.common.model.OrgFinance;
|
|
|
+import com.goafanti.common.model.OrgHonorDatum;
|
|
|
+import com.goafanti.common.model.OrgHumanResource;
|
|
|
+import com.goafanti.common.model.OrgIntellectualProperty;
|
|
|
+import com.goafanti.common.model.OrgRatepay;
|
|
|
+import com.goafanti.common.model.OrgStandard;
|
|
|
+import com.goafanti.common.model.OrgTechAchievement;
|
|
|
+import com.goafanti.common.model.OrgTechCenterDetail;
|
|
|
+import com.goafanti.common.model.OrgTechProduct;
|
|
|
import com.goafanti.common.model.PatentInfo;
|
|
|
+import com.goafanti.common.model.TechProject;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.common.utils.SHA256Util;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
+import com.goafanti.copyright.bo.CopyrightInfoDetail;
|
|
|
+import com.goafanti.copyright.service.CopyrightInfoService;
|
|
|
import com.goafanti.patent.service.PatentInfoService;
|
|
|
+import com.goafanti.techproject.service.TechProjectService;
|
|
|
+import com.goafanti.user.service.OrgHumanResourceService;
|
|
|
import com.goafanti.user.service.UserService;
|
|
|
|
|
|
@Controller
|
|
|
@@ -26,12 +52,38 @@ import com.goafanti.user.service.UserService;
|
|
|
public class PreviewController extends BaseApiController {
|
|
|
|
|
|
@Resource
|
|
|
- private PatentInfoService patentInfoService;
|
|
|
+ private PatentInfoService patentInfoService;
|
|
|
@Resource
|
|
|
- private UserService userService;
|
|
|
+ private UserService userService;
|
|
|
+ @Resource
|
|
|
+ private CopyrightInfoService copyrightInfoService;
|
|
|
+ @Resource
|
|
|
+ private TechProjectService techProjectService;
|
|
|
+ @Resource
|
|
|
+ private OrgTechCenterDetailService orgTechCenterDetailService;
|
|
|
+ @Resource
|
|
|
+ private OrgActivityService orgActivityService;
|
|
|
+ @Resource
|
|
|
+ private OrgActivityCostService orgActivityCostService;
|
|
|
+ @Resource
|
|
|
+ private OrgTechProductService orgTechProductService;
|
|
|
+ @Resource
|
|
|
+ private OrgIntellectualPropertyService orgIntellectualPropertyService;
|
|
|
+ @Resource
|
|
|
+ private OrgTechAchievementService orgTechAchievementService;
|
|
|
+ @Resource
|
|
|
+ private OrgRatepayService orgRatepayService;
|
|
|
+ @Resource
|
|
|
+ private OrgFinanceService orgFinanceService;
|
|
|
+ @Resource
|
|
|
+ private OrgHumanResourceService OrgHumanResourceService;
|
|
|
+ @Resource
|
|
|
+ private OrgHonorDatumService OrgHonorDatumService;
|
|
|
+ @Resource
|
|
|
+ private OrgStandardService orgStandardService;
|
|
|
|
|
|
@Value(value = "${aesSecretKey}")
|
|
|
- private String secretKey = null;
|
|
|
+ private String secretKey = null;
|
|
|
|
|
|
@RequestMapping(value = "/preview", method = RequestMethod.GET)
|
|
|
public Result preview(HttpServletResponse response, String sign, String temp, String token, String auth) {
|
|
|
@@ -58,6 +110,126 @@ public class PreviewController extends BaseApiController {
|
|
|
handlePatentPreview(response, pi, attachmentType);
|
|
|
}
|
|
|
break;
|
|
|
+ case LAST_YEAR_RATEPAY:
|
|
|
+ case RATEPAY:
|
|
|
+ OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(token);
|
|
|
+ if (null == ratepay) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleRatepayPreview(response, ratepay, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case COPYRIGHT_AUTH:
|
|
|
+ case COPYRIGHT_APPLY:
|
|
|
+ CopyrightInfoDetail ci = copyrightInfoService.findByPrimaryKey(token);
|
|
|
+ if (null == ci) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleCopyrightPreview(response, ci, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case TECH_PROJECT:
|
|
|
+ TechProject tp = techProjectService.selectByPrimaryKey(token);
|
|
|
+ if (null == tp) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleTechProjectPreview(response, tp, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PROTOCOL:
|
|
|
+ OrgTechCenterDetail otcd = orgTechCenterDetailService.selectByPrimaryKey(token);
|
|
|
+ if (null == otcd) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleTechCenterDetailPreview(response, otcd, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PROOF:
|
|
|
+ OrgActivity oa = orgActivityService.selectOrgActivityByPrimaryKey(token);
|
|
|
+ if (null == oa) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleActivityPreview(response, oa, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ACTIVITY_COST_ACCOUNT:
|
|
|
+ OrgActivityCost oac = orgActivityCostService.selectByPrimaryKey(token);
|
|
|
+ if (null == oac) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleActivityCostPreview(response, oac, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case TECH_PRODUCT:
|
|
|
+ OrgTechProduct otp = orgTechProductService.selectByPrimaryKey(token);
|
|
|
+ if (null == otp) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleTechProductPreview(response, otp, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PROPERTY_RIGHT:
|
|
|
+ OrgIntellectualProperty oip = orgIntellectualPropertyService.selectByPrimaryKey(token);
|
|
|
+ if (null == oip) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleIntellectualPropertyPreview(response, oip, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ACHIEVEMENT:
|
|
|
+ OrgTechAchievement ota = orgTechAchievementService.selectByPrimaryKey(token);
|
|
|
+ if (null == ota) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleAchievementPreview(response, ota, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case FINANCE:
|
|
|
+ OrgFinance of = orgFinanceService.selectByPrimaryKey(token);
|
|
|
+ if (null == of) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleFinancePreview(response, of, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ROSTER:
|
|
|
+ case SOCIAL_SECURITY:
|
|
|
+ OrgHumanResource ohr = OrgHumanResourceService.selectByPrimaryKey(token);
|
|
|
+ if (null == ohr) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleHumanResourcePreview(response, ohr, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case HONOR:
|
|
|
+ OrgHonorDatum ohd = OrgHonorDatumService.selectByPrimaryKey(token);
|
|
|
+ if (null == ohd) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleHonorPreview(response, ohd, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case STANDARD:
|
|
|
+ OrgStandard os = orgStandardService.selectByPrimaryKey(token);
|
|
|
+ if (null == os){
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "预览"));
|
|
|
+ return res;
|
|
|
+ } else {
|
|
|
+ handleStandardPreview(response, os, attachmentType);
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "预览"));
|
|
|
}
|
|
|
@@ -65,6 +237,7 @@ public class PreviewController extends BaseApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void handlePatentPreview(HttpServletResponse response, PatentInfo pi, AttachmentType attachmentType) {
|
|
|
if (attachmentType == AttachmentType.PATENT_PRORY_STATEMENT) {
|
|
|
downloadFile(response, pi.getPatentProryStatementDownloadFileName(), pi.getPatentProryStatementUrl());
|
|
|
@@ -77,4 +250,92 @@ public class PreviewController extends BaseApiController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void handleRatepayPreview(HttpServletResponse response, OrgRatepay ratepay, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.LAST_YEAR_RATEPAY || attachmentType == AttachmentType.RATEPAY) {
|
|
|
+ downloadFile(response, ratepay.getTaxReturnDownloadFileName(), ratepay.getTaxReturnUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleCopyrightPreview(HttpServletResponse response, CopyrightInfoDetail ci,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.COPYRIGHT_AUTH) {
|
|
|
+ downloadFile(response, ci.getCertificateUrlDownloadFileName(), ci.getCertificateUrl());
|
|
|
+ } else if (attachmentType == AttachmentType.COPYRIGHT_APPLY) {
|
|
|
+ downloadFile(response, ci.getApplicationUrlDownloadFileName(), ci.getApplicationUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleTechProjectPreview(HttpServletResponse response, TechProject tp, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.TECH_PROJECT) {
|
|
|
+ downloadFile(response, tp.getApprovalDownloadFileName(), tp.getApprovalUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleTechCenterDetailPreview(HttpServletResponse response, OrgTechCenterDetail otcd,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.PROTOCOL) {
|
|
|
+ downloadFile(response, otcd.getProtocolDownloadFileName(), otcd.getProtocolUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleActivityPreview(HttpServletResponse response, OrgActivity oa, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.PROOF) {
|
|
|
+ downloadFile(response, oa.getProofDownloadFileName(), oa.getProofUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleActivityCostPreview(HttpServletResponse response, OrgActivityCost oac,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
|
|
|
+ downloadFile(response, oac.getAccountDownloadFileName(), oac.getAccountUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleTechProductPreview(HttpServletResponse response, OrgTechProduct otp,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.TECH_PRODUCT) {
|
|
|
+ downloadFile(response, otp.getAccountDownloadFileName(), otp.getAccountUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleIntellectualPropertyPreview(HttpServletResponse response, OrgIntellectualProperty oip,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.TECH_PRODUCT) {
|
|
|
+ downloadFile(response, oip.getPropertyRightDownloadFileName(), oip.getPropertyRightUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleAchievementPreview(HttpServletResponse response, OrgTechAchievement ota,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.TECH_PRODUCT) {
|
|
|
+ downloadFile(response, ota.getEnclosureDownloadFileName(), ota.getEnclosureUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleFinancePreview(HttpServletResponse response, OrgFinance of, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.FINANCE) {
|
|
|
+ downloadFile(response, of.getFinanceDownloadFileName(), of.getFinanceUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleHumanResourcePreview(HttpServletResponse response, OrgHumanResource ohr,
|
|
|
+ AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.ROSTER) {
|
|
|
+ downloadFile(response, ohr.getRosterDownloadFileName(), ohr.getRosterUrl());
|
|
|
+ } else if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
|
|
|
+ downloadFile(response, ohr.getSocialSecurityDownloadFileName(), ohr.getSocialSecurityUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleHonorPreview(HttpServletResponse response, OrgHonorDatum ohd, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.HONOR) {
|
|
|
+ downloadFile(response, ohd.getEnclosureDownloadFileName(), ohd.getEnclosureUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleStandardPreview(HttpServletResponse response, OrgStandard os, AttachmentType attachmentType) {
|
|
|
+ if (attachmentType == AttachmentType.STANDARD) {
|
|
|
+ downloadFile(response, os.getStandardDownloadFileName(), os.getEnclosureUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|