Antiloveg 8 роки тому
батько
коміт
9181391a24

+ 264 - 3
src/main/java/com/goafanti/common/controller/PreviewController.java

@@ -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());
+		}
+	}
 }

+ 2 - 2
src/main/java/com/goafanti/common/dao/CopyrightLogMapper.java

@@ -3,7 +3,7 @@ package com.goafanti.common.dao;
 import java.util.List;
 
 import com.goafanti.common.model.CopyrightLog;
-import com.goafanti.copyright.bo.CopyrightLogBO;
+import com.goafanti.copyright.bo.CopyrightLogBo;
 
 public interface CopyrightLogMapper {
 	int deleteByPrimaryKey(String id);
@@ -18,7 +18,7 @@ public interface CopyrightLogMapper {
 
 	int updateByPrimaryKey(CopyrightLog record);
 
-	List<CopyrightLogBO> findByCopyrightId(String id);
+	List<CopyrightLogBo> findByCopyrightId(String id);
 
 	int batchInsert(List<CopyrightLog> log);
 }

+ 1 - 1
src/main/java/com/goafanti/common/mapper/CopyrightLogMapper.xml

@@ -114,7 +114,7 @@
       comment = #{comment,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
-  <select id="findByCopyrightId" parameterType="java.lang.String" resultType="com.goafanti.copyright.bo.CopyrightLogBO">
+  <select id="findByCopyrightId" parameterType="java.lang.String" resultType="com.goafanti.copyright.bo.CopyrightLogBo">
     select a.name as principal, b.name as operator, cl.record_time as recordTime, cl.status as status, cl.comment as comment
     from copyright_log cl
    	left join admin a on cl.principal = a.id

+ 1 - 1
src/main/java/com/goafanti/copyright/bo/CopyrightLogBO.java

@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat.Shape;
 import com.goafanti.common.constant.AFTConstants;
 
-public class CopyrightLogBO {
+public class CopyrightLogBo {
 
 	/**
 	 * 操作时间

+ 3 - 3
src/main/java/com/goafanti/copyright/controller/CopyrightApiController.java

@@ -28,7 +28,7 @@ import com.goafanti.common.model.CopyrightInfo;
 import com.goafanti.common.model.CopyrightLog;
 import com.goafanti.common.model.User;
 import com.goafanti.copyright.bo.CopyrightInfoDetail;
-import com.goafanti.copyright.bo.CopyrightLogBO;
+import com.goafanti.copyright.bo.CopyrightLogBo;
 import com.goafanti.copyright.bo.InputCopyright;
 import com.goafanti.copyright.service.CopyrightInfoService;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -238,8 +238,8 @@ public class CopyrightApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "软著申请id"));
 			return res;
 		}
-		List<CopyrightLogBO> list = copyrightInfoService.findLogsByPrimaryKey(id);
-		for (CopyrightLogBO log : list) {
+		List<CopyrightLogBo> list = copyrightInfoService.findLogsByPrimaryKey(id);
+		for (CopyrightLogBo log : list) {
 			if (CopyrightStatus.getStatus(log.getStatus()) == CopyrightStatus.SIGN 
 					|| CopyrightStatus.getStatus(log.getStatus()) == CopyrightStatus.CIRCULATION
 					|| CopyrightStatus.getStatus(log.getStatus()) == CopyrightStatus.SETTLEMENT) {

+ 2 - 2
src/main/java/com/goafanti/copyright/service/CopyrightInfoService.java

@@ -7,7 +7,7 @@ import com.goafanti.common.model.CopyrightInfo;
 import com.goafanti.common.model.CopyrightLog;
 import com.goafanti.copyright.bo.CopyrightInfoDetail;
 import com.goafanti.copyright.bo.CopyrightInfoSummary;
-import com.goafanti.copyright.bo.CopyrightLogBO;
+import com.goafanti.copyright.bo.CopyrightLogBo;
 import com.goafanti.core.mybatis.page.Pagination;
 
 public interface CopyrightInfoService {
@@ -32,7 +32,7 @@ public interface CopyrightInfoService {
 			CopyrightStatus status, String[] createTime, String[] acceptTime, String[] authTime, Integer pageNo,
 			Integer pageSize, String uid);
 
-	List<CopyrightLogBO> findLogsByPrimaryKey(String id);
+	List<CopyrightLogBo> findLogsByPrimaryKey(String id);
 
 	int batchCirculation(String[] ids, String recordTimeFormattedDate, CopyrightLog cl);
 

+ 2 - 2
src/main/java/com/goafanti/copyright/service/impl/CopyrightInfoServiceImpl.java

@@ -34,7 +34,7 @@ import com.goafanti.common.model.OrgIntellectualProperty;
 import com.goafanti.common.model.User;
 import com.goafanti.copyright.bo.CopyrightInfoDetail;
 import com.goafanti.copyright.bo.CopyrightInfoSummary;
-import com.goafanti.copyright.bo.CopyrightLogBO;
+import com.goafanti.copyright.bo.CopyrightLogBo;
 import com.goafanti.copyright.service.CopyrightInfoService;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -214,7 +214,7 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 	}
 
 	@Override
-	public List<CopyrightLogBO> findLogsByPrimaryKey(String id) {
+	public List<CopyrightLogBo> findLogsByPrimaryKey(String id) {
 		return copyrightLogMapper.findByCopyrightId(id);
 	}