| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- package com.goafanti.admin.controller;
- import java.util.Calendar;
- import javax.annotation.Resource;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- 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.controller.CertifyApiController;
- import com.goafanti.common.enums.AttachmentType;
- import com.goafanti.common.model.CopyrightInfo;
- 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.SHA256Util;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.copyright.service.CopyrightInfoService;
- import com.goafanti.patent.service.PatentInfoService;
- import com.goafanti.techproject.service.TechProjectService;
- import com.goafanti.user.service.OrgHumanResourceService;
- @RestController
- @RequestMapping(value = "/api/admin/preview")
- public class AdminPreviewApiController extends CertifyApiController {
- @Resource
- private PatentInfoService patentInfoService;
- @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;
- /**
- * 专利相关材料(专利代理委托书、专利稿件、授权通知书、专利证书、上年度纳税报表)预览授权
- *
- * @param id
- * @param sign
- * @param response
- * @return
- */
- @RequestMapping(value = "/patent", method = RequestMethod.GET)
- public Result previewPatent(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "专利ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.LAST_YEAR_RATEPAY) {
- OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(id);
- if (null == ratepay) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "纳税报表ID"));
- return res;
- }
- } else {
- PatentInfo pi = patentInfoService.selectByPrimaryKey(id);
- if (null == pi) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "专利ID"));
- return res;
- }
- }
- if (attachmentType == AttachmentType.PATENT_PRORY_STATEMENT || attachmentType == AttachmentType.PATENT_WRITING
- || attachmentType == AttachmentType.AUTHORIZATION_NOTICE
- || attachmentType == AttachmentType.LAST_YEAR_RATEPAY
- || attachmentType == AttachmentType.PATENT_CERTIFICATE) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 软著相关材料(软著申请书、软著证书)预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/copyright", method = RequestMethod.GET)
- public Result previewCopyright(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "软著ID"));
- return res;
- }
- CopyrightInfo ci = copyrightInfoService.selectByPrimaryKey(id);
- if (null == ci) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "软著ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.COPYRIGHT_AUTH || attachmentType == AttachmentType.COPYRIGHT_APPLY) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 科技项目材料预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/techProject", method = RequestMethod.GET)
- public Result previewTechProject(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技项目申报ID"));
- return res;
- }
- TechProject tp = techProjectService.selectByPrimaryKey(id);
- if (null == tp) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技项目申报ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.TECH_PROJECT) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token2=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业研发机构-产学研协议附件预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/techCenterDetail", method = RequestMethod.GET)
- public Result previewTechCenterDetail(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研记录ID"));
- return res;
- }
- OrgTechCenterDetail otcd = orgTechCenterDetailService.selectByPrimaryKey(id);
- if (null == otcd) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研记录ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROTOCOL) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 研发活动立项证明材料预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/activity", method = RequestMethod.GET)
- public Result previewActivity(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动ID"));
- return res;
- }
- OrgActivity oa = orgActivityService.selectOrgActivityByPrimaryKey(id);
- if (null == oa) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROOF) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 研发活动费用台帐预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/activityCost", method = RequestMethod.GET)
- public Result previewActivityCost(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动费用ID"));
- return res;
- }
- OrgActivityCost oac = orgActivityCostService.selectByPrimaryKey(id);
- if (null == oac) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动费用ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 高新技术产品台帐预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/techProduct", method = RequestMethod.GET)
- public Result previewTechProduct(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品ID"));
- return res;
- }
- OrgTechProduct otp = orgTechProductService.selectByPrimaryKey(id);
- if (null == otp) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.TECH_PRODUCT) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 知识产权证书及稿件预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/intellectualProperty", method = RequestMethod.GET)
- public Result previewIntellectualProperty(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
- OrgIntellectualProperty oip = orgIntellectualPropertyService.selectByPrimaryKey(id);
- if (null == oip) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
- return res;
- }
- } else if (attachmentType == AttachmentType.PATENT_WRITING) {
- PatentInfo pi = patentInfoService.selectByPrimaryKey(id);
- if (null == pi) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "专利稿件ID"));
- return res;
- }
- } else if (attachmentType == AttachmentType.COPYRIGHT_APPLY) {
- CopyrightInfo ci = copyrightInfoService.selectByPrimaryKey(id);
- if (null == ci) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权申请书ID"));
- return res;
- }
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- return res;
- }
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- return res;
- }
- /**
- * 科技成果附件预览授权
- *
- * @param id
- * @param sing
- * @return
- */
- @RequestMapping(value = "/achievement", method = RequestMethod.GET)
- public Result previewAchievement(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
- return res;
- }
- OrgTechAchievement ota = orgTechAchievementService.selectByPrimaryKey(id);
- if (null == ota) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACHIEVEMENT) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 所得税纳税申报表预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/ratepay", method = RequestMethod.GET)
- public Result previewRatepay(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "纳税申报表ID"));
- return res;
- }
- OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(id);
- if (null == ratepay) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "纳税申报表ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.RATEPAY) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 财务报表预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/finance", method = RequestMethod.GET)
- public Result previewFinance(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "财务报表ID"));
- return res;
- }
- OrgFinance of = orgFinanceService.selectByPrimaryKey(id);
- if (null == of) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "财务报表ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.FINANCE) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 人力资源情况预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/humanResource", method = RequestMethod.GET)
- public Result previewHumanResource(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "人力资源ID"));
- return res;
- }
- OrgHumanResource ohr = OrgHumanResourceService.selectByPrimaryKey(id);
- if (null == ohr) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "人力资源ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ROSTER || attachmentType == AttachmentType.SOCIAL_SECURITY) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业荣誉及其他证明材料预览授权
- *
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/honor", method = RequestMethod.GET)
- public Result previewHonor(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业荣誉及其他证明材料ID"));
- return res;
- }
- OrgHonorDatum ohd = OrgHonorDatumService.selectByPrimaryKey(id);
- if (null == ohd) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业荣誉及其他证明材料ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.HONOR) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 标准制定情况附件预览授权
- * @param id
- * @param sign
- * @return
- */
- @RequestMapping(value = "/standard", method = RequestMethod.GET)
- public Result previewStandard(String id, String sign) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准制定情况ID"));
- return res;
- }
- OrgStandard os = orgStandardService.selectByPrimaryKey(id);
- if (null == os) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准制定情况ID"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.STANDARD) {
- String time = String.valueOf(Calendar.getInstance().getTime().getTime());
- String auth = SHA256Util.toHash(sign + "|" + id + "|" + secretKey, time);
- res.setData("sign=" + sign + "&token=" + id + "&auth=" + auth + "&temp=" + time);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- }
|