CognizanceApiController.java 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579
  1. package com.goafanti.cognizance.controller;
  2. import java.io.IOException;
  3. import java.math.BigDecimal;
  4. import java.text.ParseException;
  5. import java.util.Arrays;
  6. import java.util.Calendar;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import java.util.UUID;
  11. import javax.annotation.Resource;
  12. import javax.servlet.http.HttpServletRequest;
  13. import javax.servlet.http.HttpServletResponse;
  14. import javax.validation.Valid;
  15. import org.springframework.beans.BeanUtils;
  16. import org.springframework.stereotype.Controller;
  17. import org.springframework.validation.BindingResult;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RequestMethod;
  20. import org.springframework.web.bind.annotation.RequestParam;
  21. import org.springframework.web.multipart.MultipartFile;
  22. import com.goafanti.cognizance.bo.ActivityNumberBo;
  23. import com.goafanti.cognizance.bo.AnnualReportBo;
  24. import com.goafanti.cognizance.bo.CognizanceDetailBo;
  25. import com.goafanti.cognizance.bo.InputApplyCognizance;
  26. import com.goafanti.cognizance.bo.InputOrgActivity;
  27. import com.goafanti.cognizance.bo.InputOrgActivityCost;
  28. import com.goafanti.cognizance.bo.InputOrgAnnualReport;
  29. import com.goafanti.cognizance.bo.InputOrgCognizance;
  30. import com.goafanti.cognizance.bo.InputOrgFinance;
  31. import com.goafanti.cognizance.bo.InputOrgHonorDatum;
  32. import com.goafanti.cognizance.bo.InputOrgIntellectualProperty;
  33. import com.goafanti.cognizance.bo.InputOrgRatepay;
  34. import com.goafanti.cognizance.bo.InputOrgStandard;
  35. import com.goafanti.cognizance.bo.InputOrgTechAchievement;
  36. import com.goafanti.cognizance.bo.InputOrgTechCenter;
  37. import com.goafanti.cognizance.bo.InputOrgTechCenterDetail;
  38. import com.goafanti.cognizance.bo.InputOrgTechProduct;
  39. import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
  40. import com.goafanti.cognizance.service.OrgActivityCostService;
  41. import com.goafanti.cognizance.service.OrgActivityService;
  42. import com.goafanti.cognizance.service.OrgAnnualReportService;
  43. import com.goafanti.cognizance.service.OrgCognizanceLogService;
  44. import com.goafanti.cognizance.service.OrgCognizanceService;
  45. import com.goafanti.cognizance.service.OrgFinanceService;
  46. import com.goafanti.cognizance.service.OrgHonorDatumService;
  47. import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
  48. import com.goafanti.cognizance.service.OrgRatepayService;
  49. import com.goafanti.cognizance.service.OrgStandardService;
  50. import com.goafanti.cognizance.service.OrgTechAchievementService;
  51. import com.goafanti.cognizance.service.OrgTechCenterDetailService;
  52. import com.goafanti.cognizance.service.OrgTechCenterService;
  53. import com.goafanti.cognizance.service.OrgTechProductService;
  54. import com.goafanti.common.bo.Result;
  55. import com.goafanti.common.constant.AFTConstants;
  56. import com.goafanti.common.constant.ErrorConstants;
  57. import com.goafanti.common.controller.CertifyApiController;
  58. import com.goafanti.common.enums.AttachmentType;
  59. import com.goafanti.common.enums.CognizanceApplyFields;
  60. import com.goafanti.common.enums.DeleteStatus;
  61. import com.goafanti.common.enums.FinanceRatepayFields;
  62. import com.goafanti.common.enums.IntellectualPropertyType;
  63. import com.goafanti.common.enums.OrgActivityFields;
  64. import com.goafanti.common.enums.OrgAnnualReportFields;
  65. import com.goafanti.common.enums.OrgCognizanceFields;
  66. import com.goafanti.common.enums.OrgCognizanceStatus;
  67. import com.goafanti.common.enums.OrgFinanceFields;
  68. import com.goafanti.common.enums.OrgHonorDatumFields;
  69. import com.goafanti.common.enums.OrgIntellectualPropertyFields;
  70. import com.goafanti.common.enums.OrgRatepayFields;
  71. import com.goafanti.common.enums.OrgStandardFields;
  72. import com.goafanti.common.enums.OrgTechAchievementFields;
  73. import com.goafanti.common.enums.OrgTechCenterDetailFields;
  74. import com.goafanti.common.enums.OrgTechCenterFields;
  75. import com.goafanti.common.enums.OrgTechProductFields;
  76. import com.goafanti.common.model.OrgActivity;
  77. import com.goafanti.common.model.OrgActivityCost;
  78. import com.goafanti.common.model.OrgAnnualReport;
  79. import com.goafanti.common.model.OrgCognizance;
  80. import com.goafanti.common.model.OrgCognizanceLog;
  81. import com.goafanti.common.model.OrgFinance;
  82. import com.goafanti.common.model.OrgHonorDatum;
  83. import com.goafanti.common.model.OrgHumanResource;
  84. import com.goafanti.common.model.OrgIntellectualProperty;
  85. import com.goafanti.common.model.OrgRatepay;
  86. import com.goafanti.common.model.OrgStandard;
  87. import com.goafanti.common.model.OrgTechAchievement;
  88. import com.goafanti.common.model.OrgTechCenter;
  89. import com.goafanti.common.model.OrgTechCenterDetail;
  90. import com.goafanti.common.model.OrgTechProduct;
  91. import com.goafanti.common.model.PatentInfo;
  92. import com.goafanti.common.model.User;
  93. import com.goafanti.common.utils.DateUtils;
  94. import com.goafanti.common.utils.FileUtils;
  95. import com.goafanti.common.utils.LoggerUtils;
  96. import com.goafanti.common.utils.StringUtils;
  97. import com.goafanti.copyright.bo.CopyrightInfoDetail;
  98. import com.goafanti.copyright.service.CopyrightInfoService;
  99. import com.goafanti.core.shiro.token.TokenManager;
  100. import com.goafanti.patent.service.PatentInfoService;
  101. import com.goafanti.user.service.OrgHumanResourceService;
  102. import com.goafanti.user.service.OrganizationIdentityService;
  103. import com.goafanti.user.service.UserService;
  104. @Controller
  105. @RequestMapping(value = "/api/user/cognizance")
  106. public class CognizanceApiController extends CertifyApiController {
  107. @Resource
  108. private UserService userService;
  109. @Resource
  110. private OrgStandardService orgStandardService;
  111. @Resource
  112. private OrgActivityService orgActivityService;
  113. @Resource
  114. private OrgIntellectualPropertyService orgIntellectualPropertyService;
  115. @Resource
  116. private OrganizationIdentityService organizationIdentityService;
  117. @Resource
  118. private OrgTechProductService orgTechProductService;
  119. @Resource
  120. private OrgActivityCostService orgActivityCostService;
  121. @Resource
  122. private OrgRatepayService orgRatepayService;
  123. @Resource
  124. private OrgFinanceService orgFinanceService;
  125. @Resource
  126. private OrgTechAchievementService orgTechAchievementService;
  127. @Resource
  128. private OrgHonorDatumService orgHonorDatumService;
  129. @Resource
  130. private OrgTechCenterService orgTechCenterService;
  131. @Resource
  132. private OrgTechCenterDetailService orgTechCenterDetailService;
  133. @Resource
  134. private OrgCognizanceService orgCognizanceService;
  135. @Resource
  136. private OrgAnnualReportService orgAnnualReportService;
  137. @Resource
  138. private OrgCognizanceLogService orgCognizanceLogService;
  139. @Resource
  140. private OrgHumanResourceService orgHumanResourceService;
  141. @Resource
  142. private PatentInfoService patentInfoService;
  143. @Resource
  144. private CopyrightInfoService copyrightInfoService;
  145. /**
  146. * 研发活动详情
  147. *
  148. * @param id
  149. * @return
  150. */
  151. @RequestMapping(value = "/activityDetail", method = RequestMethod.GET)
  152. public Result activityDetail(String id) {
  153. Result res = new Result();
  154. if (StringUtils.isBlank(id)) {
  155. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  156. return res;
  157. }
  158. Calendar a = Calendar.getInstance();
  159. res.setData(orgActivityService.selectDetailByIdAndYear(id, a.get(Calendar.YEAR) - 1));
  160. return res;
  161. }
  162. /**
  163. * 财务报表详情(获取同年度纳税申报表重复数据)
  164. *
  165. * @return
  166. */
  167. @RequestMapping(value = "/financeDetail", method = RequestMethod.GET)
  168. public Result financeDetail(Integer year) {
  169. Result res = new Result();
  170. User curUser = TokenManager.getUserToken();
  171. if (!checkCertify(res, curUser)) {
  172. return res;
  173. }
  174. if (null == year) {
  175. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  176. return res;
  177. }
  178. OrgRatepay ratepay = orgRatepayService.selectRatepayByUidAndYear(TokenManager.getUserId(), year);
  179. if (null != ratepay) {
  180. Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
  181. map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), ratepay.getGrossProfit());
  182. map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), ratepay.getManagementCost());
  183. map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), ratepay.getOperatingProfit());
  184. map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), ratepay.getResearchCost());
  185. res.setData(map);
  186. }
  187. return res;
  188. }
  189. /**
  190. * 企业纳税信息详情(获取同年度财务报表重复数据)
  191. *
  192. * @param uid
  193. * @param year
  194. * @return
  195. */
  196. @RequestMapping(value = "/ratepayDetail", method = RequestMethod.GET)
  197. public Result ratepayDetail(Integer year) {
  198. Result res = new Result();
  199. User curUser = TokenManager.getUserToken();
  200. if (!checkCertify(res, curUser)) {
  201. return res;
  202. }
  203. if (null == year) {
  204. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  205. return res;
  206. }
  207. OrgFinance of = orgFinanceService.selectFinanceByUidAndYear(TokenManager.getUserId(), year);
  208. if (null != of) {
  209. Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
  210. map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), of.getGrossProfit());
  211. map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), of.getManagementCost());
  212. map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), of.getOperatingProfit());
  213. map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), of.getResearchCost());
  214. res.setData(map);
  215. }
  216. return res;
  217. }
  218. /**
  219. * 知识产权详情
  220. *
  221. * @return
  222. */
  223. @RequestMapping(value = "/intellectualDetail", method = RequestMethod.GET)
  224. public Result intellectualDetail(String id, Integer type) {
  225. Result res = new Result();
  226. if (StringUtils.isBlank(id)) {
  227. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权ID"));
  228. return res;
  229. }
  230. if (null == type) {
  231. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
  232. return res;
  233. }
  234. OrgIntellectualProperty oip = orgIntellectualPropertyService.selectByPrimaryKey(id);
  235. if (null == oip) {
  236. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
  237. return res;
  238. }
  239. if (IntellectualPropertyType.PATENT.getCode() == type) {
  240. res.setData(orgIntellectualPropertyService.selectPatentTypeDetail(id));
  241. } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
  242. res.setData(orgIntellectualPropertyService.selectCopyrightTypeDetail(id));
  243. } else if (IntellectualPropertyType.COMMON.getCode() == type) {
  244. OrgIntellectualPropertyDetailBo oipdb = new OrgIntellectualPropertyDetailBo();
  245. BeanUtils.copyProperties(oip, oipdb);
  246. res.setData(oipdb);
  247. } else {
  248. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
  249. }
  250. return res;
  251. }
  252. /**
  253. * 知识产权稿件下载
  254. *
  255. * @param response
  256. * @param sign
  257. * @param id
  258. * @return
  259. */
  260. @RequestMapping(value = "/downloadManuscript", method = RequestMethod.GET)
  261. public Result downloadManuscript(HttpServletResponse response, String sign, String id, Integer type) {
  262. Result res = new Result();
  263. User curUser = TokenManager.getUserToken();
  264. if (!checkCertify(res, curUser)) {
  265. return res;
  266. }
  267. if (StringUtils.isEmpty(id)) {
  268. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
  269. return res;
  270. }
  271. if (null == type) {
  272. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
  273. return res;
  274. }
  275. OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
  276. if (olp == null) {
  277. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
  278. return res;
  279. }
  280. String fileName = null;
  281. String downloadUrl = null;
  282. if (IntellectualPropertyType.PATENT.getCode() == type) {
  283. PatentInfo pi = patentInfoService.selectByPrimaryKey(olp.getPid());
  284. if (null == pi) {
  285. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
  286. return res;
  287. }
  288. fileName = pi.getPatentWritingDownloadFileName();
  289. downloadUrl = pi.getPatentWritingUrl();
  290. } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
  291. CopyrightInfoDetail ci = copyrightInfoService.findByPrimaryKey(id);
  292. if (null == ci) {
  293. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
  294. return res;
  295. }
  296. fileName = ci.getApplicationUrlDownloadFileName();
  297. downloadUrl = ci.getApplicationUrl();
  298. } else {
  299. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
  300. return res;
  301. }
  302. AttachmentType attachmentType = AttachmentType.getField(sign);
  303. if (attachmentType == AttachmentType.MANUSCRIPT) {
  304. downloadFile(response, fileName, downloadUrl);
  305. } else {
  306. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  307. }
  308. return res;
  309. }
  310. /**
  311. * 删除知识产权记录
  312. *
  313. * @param id
  314. * @return
  315. */
  316. @RequestMapping(value = "/deleteIntellectual", method = RequestMethod.POST)
  317. public Result deleteIntellectual(@RequestParam(name = "ids[]", required = false) String[] ids) {
  318. Result res = new Result();
  319. if (ids == null || ids.length < 1) {
  320. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  321. } else {
  322. res.setData(orgIntellectualPropertyService.deleteByPrimaryKey(Arrays.asList(ids)));
  323. }
  324. return res;
  325. }
  326. /**
  327. * 删除标准制定情况记录
  328. *
  329. * @param id
  330. * 记录id
  331. * @return
  332. */
  333. @RequestMapping(value = "/deleteStandard", method = RequestMethod.POST)
  334. public Result deleteStandard(@RequestParam(name = "ids[]", required = false) String[] ids) {
  335. Result res = new Result();
  336. if (ids == null || ids.length < 1) {
  337. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  338. } else {
  339. res.setData(orgStandardService.deleteByPrimaryKey(Arrays.asList(ids)));
  340. }
  341. return res;
  342. }
  343. /**
  344. * 删除企业研究开发活动情况
  345. *
  346. * @param ids
  347. * @return
  348. */
  349. @RequestMapping(value = "/deleteActivity", method = RequestMethod.POST)
  350. public Result deleteActivity(@RequestParam(name = "ids[]", required = false) String[] ids) {
  351. Result res = new Result();
  352. if (ids == null || ids.length < 1) {
  353. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  354. } else {
  355. res.setData(orgActivityService.deleteByPrimaryKey(Arrays.asList(ids)));
  356. orgActivityCostService.deleteByAid(Arrays.asList(ids));
  357. }
  358. return res;
  359. }
  360. /**
  361. * 删除企业年度研究开发费用结构明细记录
  362. *
  363. * @param ids
  364. * @return
  365. */
  366. @RequestMapping(value = "/deleteActivityCost", method = RequestMethod.POST)
  367. public Result deleteActivityCost(@RequestParam(name = "ids[]", required = false) String[] ids) {
  368. Result res = new Result();
  369. if (ids == null || ids.length < 1) {
  370. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  371. } else {
  372. res.setData(orgActivityCostService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
  373. }
  374. return res;
  375. }
  376. /**
  377. * 删除技术中心明细
  378. *
  379. * @param ids
  380. * @return
  381. */
  382. @RequestMapping(value = "/deleteOrgTechCenterDetail", method = RequestMethod.POST)
  383. public Result deleteOrgTechCenterDetail(@RequestParam(name = "ids[]", required = false) String[] ids) {
  384. Result res = new Result();
  385. if (ids == null || ids.length < 1) {
  386. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  387. } else {
  388. res.setData(orgTechCenterDetailService.deleteByPrimaryKey(Arrays.asList(ids)));
  389. }
  390. return res;
  391. }
  392. /**
  393. * 删除上年度高新技术产品(服务)情况记录
  394. *
  395. * @param ids
  396. * @return
  397. */
  398. @RequestMapping(value = "/deleteTechProduct", method = RequestMethod.POST)
  399. public Result deleteTechProduct(@RequestParam(name = "ids[]", required = false) String[] ids) {
  400. Result res = new Result();
  401. if (ids == null || ids.length < 1) {
  402. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  403. } else {
  404. res.setData(orgTechProductService.deleteByPrimaryKey(Arrays.asList(ids)));
  405. }
  406. return res;
  407. }
  408. /**
  409. * 刪除企业纳税申报信息
  410. *
  411. * @param ids
  412. * @return
  413. */
  414. @RequestMapping(value = "/deleteRatepay", method = RequestMethod.POST)
  415. public Result deleteRatepay(@RequestParam(name = "ids[]", required = false) String[] ids) {
  416. Result res = new Result();
  417. if (ids == null || ids.length < 1) {
  418. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  419. } else {
  420. res.setData(orgRatepayService.deleteByPrimaryKey(Arrays.asList(ids)));
  421. }
  422. return res;
  423. }
  424. /**
  425. * 删除财务报表
  426. *
  427. * @param ids
  428. * @return
  429. */
  430. @RequestMapping(value = "/deleteFinance", method = RequestMethod.POST)
  431. public Result deleteFinance(@RequestParam(name = "ids[]", required = false) String[] ids) {
  432. Result res = new Result();
  433. if (ids == null || ids.length < 1) {
  434. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  435. } else {
  436. res.setData(orgFinanceService.deleteByPrimaryKey(Arrays.asList(ids)));
  437. }
  438. return res;
  439. }
  440. /**
  441. * 删除科技成果转化情况
  442. *
  443. * @param ids
  444. * @return
  445. */
  446. @RequestMapping(value = "/deleteAchievement", method = RequestMethod.POST)
  447. public Result deleteAchievement(@RequestParam(name = "ids[]", required = false) String[] ids) {
  448. Result res = new Result();
  449. if (ids == null || ids.length < 1) {
  450. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  451. } else {
  452. res.setData(orgTechAchievementService.deleteByPrimaryKey(Arrays.asList(ids)));
  453. }
  454. return res;
  455. }
  456. /**
  457. * 删除企业荣誉及其他证明材料
  458. *
  459. * @param ids
  460. * @return
  461. */
  462. @RequestMapping(value = "/deleteHonor", method = RequestMethod.POST)
  463. public Result deleteHonor(@RequestParam(name = "ids[]", required = false) String[] ids) {
  464. Result res = new Result();
  465. if (ids == null || ids.length < 1) {
  466. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  467. } else {
  468. res.setData(orgHonorDatumService.deleteByPrimaryKey(Arrays.asList(ids)));
  469. }
  470. return res;
  471. }
  472. /**
  473. * 企业花名册上传
  474. *
  475. * @param req
  476. * @param sign
  477. * @param uid
  478. * @return
  479. */
  480. @RequestMapping(value = "/uploadRoster", method = RequestMethod.POST)
  481. public Result uploadRoster(HttpServletRequest req, String sign, String year) {
  482. Result res = new Result();
  483. if (StringUtils.isBlank(year)) {
  484. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  485. return res;
  486. }
  487. User curUser = TokenManager.getUserToken();
  488. if (!checkCertify(res, curUser)) {
  489. return res;
  490. }
  491. AttachmentType attachmentType = AttachmentType.getField(sign);
  492. if (attachmentType == AttachmentType.ROSTER) {
  493. sign = sign + "_" + year;
  494. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  495. } else {
  496. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  497. }
  498. return res;
  499. }
  500. /**
  501. * 企业社保情况表上传
  502. *
  503. * @param req
  504. * @param sign
  505. * @param uid
  506. * @return
  507. */
  508. @RequestMapping(value = "/uploadSocialSecurity", method = RequestMethod.POST)
  509. public Result uploadSocialSecurity(HttpServletRequest req, String sign, String year) {
  510. Result res = new Result();
  511. if (StringUtils.isBlank(year)) {
  512. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  513. return res;
  514. }
  515. User curUser = TokenManager.getUserToken();
  516. if (!checkCertify(res, curUser)) {
  517. return res;
  518. }
  519. AttachmentType attachmentType = AttachmentType.getField(sign);
  520. if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
  521. sign = sign + "_" + year;
  522. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  523. } else {
  524. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  525. }
  526. return res;
  527. }
  528. /**
  529. * 企业花名册及社保情况表下载
  530. *
  531. * @param response
  532. * @param sign
  533. * @param id
  534. * @return
  535. */
  536. @RequestMapping(value = "/downloadHumanResource", method = RequestMethod.GET)
  537. public Result downloadHumanResource(HttpServletResponse response, String sign, String id) {
  538. Result res = new Result();
  539. User curUser = TokenManager.getUserToken();
  540. if (!checkCertify(res, curUser)) {
  541. return res;
  542. }
  543. if (StringUtils.isEmpty(id)) {
  544. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
  545. return res;
  546. }
  547. OrgHumanResource ohr = orgHumanResourceService.selectByPrimaryKey(id);
  548. if (ohr == null || !curUser.getId().equals(ohr.getUid())) {
  549. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
  550. return res;
  551. }
  552. AttachmentType attachmentType = AttachmentType.getField(sign);
  553. if (attachmentType == AttachmentType.ROSTER) {
  554. downloadFile(response, ohr.getRosterDownloadFileName(), ohr.getRosterUrl());
  555. } else if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
  556. downloadFile(response, ohr.getSocialSecurityDownloadFileName(), ohr.getSocialSecurityUrl());
  557. } else {
  558. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  559. }
  560. return res;
  561. }
  562. /**
  563. * 知识产权证书上传
  564. *
  565. * @param req
  566. * @param sign
  567. * @param uid
  568. * @return
  569. */
  570. @RequestMapping(value = "/uploadPropertyRight", method = RequestMethod.POST)
  571. public Result uploadPropertyRight(HttpServletRequest req, String sign) {
  572. Result res = new Result();
  573. User curUser = TokenManager.getUserToken();
  574. if (!checkCertify(res, curUser)) {
  575. return res;
  576. }
  577. AttachmentType attachmentType = AttachmentType.getField(sign);
  578. if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
  579. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  580. } else {
  581. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  582. }
  583. return res;
  584. }
  585. /**
  586. * 知识产权证书下载
  587. *
  588. * @param response
  589. * @param sign
  590. * @param id
  591. * @return
  592. */
  593. @RequestMapping(value = "/downloadPropertyRight", method = RequestMethod.GET)
  594. public Result downloadPropertyRight(HttpServletResponse response, String sign, String id) {
  595. Result res = new Result();
  596. User curUser = TokenManager.getUserToken();
  597. if (!checkCertify(res, curUser)) {
  598. return res;
  599. }
  600. if (StringUtils.isEmpty(id)) {
  601. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
  602. return res;
  603. }
  604. OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
  605. if (olp == null || !curUser.getId().equals(olp.getUid())) {
  606. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
  607. return res;
  608. }
  609. AttachmentType attachmentType = AttachmentType.getField(sign);
  610. if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
  611. downloadFile(response, olp.getPropertyRightDownloadFileName(), olp.getPropertyRightUrl());
  612. } else {
  613. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  614. }
  615. return res;
  616. }
  617. /**
  618. * 高新技术产品台帐上传
  619. *
  620. * @param req
  621. * @param sign
  622. * @param uid
  623. * @return
  624. */
  625. @RequestMapping(value = "/uploadTecProduct", method = RequestMethod.POST)
  626. public Result uploadTecProduct(HttpServletRequest req, String sign) {
  627. Result res = new Result();
  628. User curUser = TokenManager.getUserToken();
  629. if (!checkCertify(res, curUser)) {
  630. return res;
  631. }
  632. AttachmentType attachmentType = AttachmentType.getField(sign);
  633. if (attachmentType == AttachmentType.TECH_PRODUCT) {
  634. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  635. } else {
  636. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  637. }
  638. return res;
  639. }
  640. /**
  641. * 高新技术产品台帐下载
  642. *
  643. * @param response
  644. * @param sign
  645. * @param id
  646. * @return
  647. */
  648. @RequestMapping(value = "/downloadTecProduct", method = RequestMethod.GET)
  649. public Result downloadTecProduct(HttpServletResponse response, String sign, String id) {
  650. Result res = new Result();
  651. User curUser = TokenManager.getUserToken();
  652. if (!checkCertify(res, curUser)) {
  653. return res;
  654. }
  655. if (StringUtils.isEmpty(id)) {
  656. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
  657. return res;
  658. }
  659. OrgTechProduct otp = orgTechProductService.selectByPrimaryKey(id);
  660. if (otp == null || !curUser.getId().equals(otp.getUid())) {
  661. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
  662. return res;
  663. }
  664. AttachmentType attachmentType = AttachmentType.getField(sign);
  665. if (attachmentType == AttachmentType.TECH_PRODUCT) {
  666. downloadFile(response, otp.getAccountDownloadFileName(), otp.getAccountUrl());
  667. } else {
  668. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  669. }
  670. return res;
  671. }
  672. /**
  673. * 研发活动立项证明材料上传
  674. *
  675. * @param req
  676. * @param sign
  677. * @param uid
  678. * @return
  679. */
  680. @RequestMapping(value = "/uploadProof", method = RequestMethod.POST)
  681. public Result uploadProof(HttpServletRequest req, String sign) {
  682. Result res = new Result();
  683. User curUser = TokenManager.getUserToken();
  684. if (!checkCertify(res, curUser)) {
  685. return res;
  686. }
  687. AttachmentType attachmentType = AttachmentType.getField(sign);
  688. if (attachmentType == AttachmentType.PROOF) {
  689. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  690. } else {
  691. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  692. }
  693. return res;
  694. }
  695. /**
  696. * 研发活动立项证明材料下载
  697. *
  698. * @param response
  699. * @param sign
  700. * @param id
  701. * @return
  702. */
  703. @RequestMapping(value = "/downloadProof", method = RequestMethod.GET)
  704. public Result downloadProof(HttpServletResponse response, String sign, String id) {
  705. Result res = new Result();
  706. User curUser = TokenManager.getUserToken();
  707. if (!checkCertify(res, curUser)) {
  708. return res;
  709. }
  710. if (StringUtils.isEmpty(id)) {
  711. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  712. return res;
  713. }
  714. OrgActivity oa = orgActivityService.selectOrgActivityByPrimaryKey(id);
  715. if (oa == null || !curUser.getId().equals(oa.getUid())) {
  716. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  717. return res;
  718. }
  719. AttachmentType attachmentType = AttachmentType.getField(sign);
  720. if (attachmentType == AttachmentType.PROOF) {
  721. downloadFile(response, oa.getProofDownloadFileName(), oa.getProofUrl());
  722. } else {
  723. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  724. }
  725. return res;
  726. }
  727. /**
  728. * 研发活动费用台帐上传
  729. *
  730. * @param req
  731. * @param sign
  732. * @param uid
  733. * @return
  734. */
  735. @RequestMapping(value = "/uploadActivityCost", method = RequestMethod.POST)
  736. public Result uploadActivityCost(HttpServletRequest req, String sign) {
  737. Result res = new Result();
  738. User curUser = TokenManager.getUserToken();
  739. if (!checkCertify(res, curUser)) {
  740. return res;
  741. }
  742. AttachmentType attachmentType = AttachmentType.getField(sign);
  743. if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
  744. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  745. } else {
  746. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  747. }
  748. return res;
  749. }
  750. /**
  751. * 研发活动费用台帐下载
  752. *
  753. * @param response
  754. * @param sign
  755. * @param id
  756. * @return
  757. */
  758. @RequestMapping(value = "/downloadActivityCost", method = RequestMethod.GET)
  759. public Result downloadActivityCost(HttpServletResponse response, String sign, String id) {
  760. Result res = new Result();
  761. User curUser = TokenManager.getUserToken();
  762. if (!checkCertify(res, curUser)) {
  763. return res;
  764. }
  765. if (StringUtils.isEmpty(id)) {
  766. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
  767. return res;
  768. }
  769. OrgActivityCost oac = orgActivityCostService.selectByPrimaryKey(id);
  770. if (oac == null || !curUser.getId().equals(oac.getUid())) {
  771. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
  772. return res;
  773. }
  774. AttachmentType attachmentType = AttachmentType.getField(sign);
  775. if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
  776. downloadFile(response, oac.getAccountDownloadFileName(), oac.getAccountUrl());
  777. } else {
  778. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  779. }
  780. return res;
  781. }
  782. /**
  783. * 实名认证--企业上年度纳税申报表上传
  784. *
  785. * @param req
  786. * @param sign
  787. * @param uid
  788. * @return
  789. */
  790. @RequestMapping(value = "/uploadLastYearRatepay", method = RequestMethod.POST)
  791. public Result uploadLastYearRatepay(HttpServletRequest req, String sign) {
  792. Result res = new Result();
  793. AttachmentType attachmentType = AttachmentType.getField(sign);
  794. if (attachmentType == AttachmentType.RATEPAY) {
  795. Calendar now = Calendar.getInstance();
  796. sign = sign + "_" + (now.get(Calendar.YEAR) - 1);
  797. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  798. } else {
  799. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  800. }
  801. return res;
  802. }
  803. /**
  804. * 企业纳税申报表上传
  805. *
  806. * @param req
  807. * @param sign
  808. * @param uid
  809. * @return
  810. */
  811. @RequestMapping(value = "/uploadRatepay", method = RequestMethod.POST)
  812. public Result uploadRatepay(HttpServletRequest req, String sign, String year) {
  813. Result res = new Result();
  814. User curUser = TokenManager.getUserToken();
  815. if (!checkCertify(res, curUser)) {
  816. return res;
  817. }
  818. if (StringUtils.isBlank(year)) {
  819. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  820. return res;
  821. }
  822. AttachmentType attachmentType = AttachmentType.getField(sign);
  823. if (attachmentType == AttachmentType.RATEPAY) {
  824. sign = sign + "_" + year;
  825. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  826. } else {
  827. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  828. }
  829. return res;
  830. }
  831. /**
  832. * 企业纳税申报表下载
  833. *
  834. * @param response
  835. * @param sign
  836. * @param id
  837. * @return
  838. */
  839. @RequestMapping(value = "/downloadRatepay", method = RequestMethod.GET)
  840. public Result downloadRatepay(HttpServletResponse response, String sign, String id) {
  841. Result res = new Result();
  842. User curUser = TokenManager.getUserToken();
  843. if (!checkCertify(res, curUser)) {
  844. return res;
  845. }
  846. if (StringUtils.isEmpty(id)) {
  847. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
  848. return res;
  849. }
  850. OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(id);
  851. if (ratepay == null || !curUser.getId().equals(ratepay.getUid())) {
  852. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
  853. return res;
  854. }
  855. AttachmentType attachmentType = AttachmentType.getField(sign);
  856. if (attachmentType == AttachmentType.RATEPAY) {
  857. downloadFile(response, ratepay.getTaxReturnDownloadFileName(), ratepay.getTaxReturnUrl());
  858. } else {
  859. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  860. }
  861. return res;
  862. }
  863. /**
  864. * 企业财务报表上传
  865. *
  866. * @param req
  867. * @param sign
  868. * @param uid
  869. * @return
  870. */
  871. @RequestMapping(value = "/uploadFinance", method = RequestMethod.POST)
  872. public Result uploadFinance(HttpServletRequest req, String sign, String year) {
  873. Result res = new Result();
  874. User curUser = TokenManager.getUserToken();
  875. if (!checkCertify(res, curUser)) {
  876. return res;
  877. }
  878. if (StringUtils.isBlank(year)) {
  879. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  880. return res;
  881. }
  882. AttachmentType attachmentType = AttachmentType.getField(sign);
  883. if (attachmentType == AttachmentType.FINANCE) {
  884. sign = sign + "_" + year;
  885. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  886. } else {
  887. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  888. }
  889. return res;
  890. }
  891. /**
  892. * 企业财务报表下载
  893. *
  894. * @param response
  895. * @param sign
  896. * @param id
  897. * @return
  898. */
  899. @RequestMapping(value = "/downloadFinance", method = RequestMethod.GET)
  900. public Result downloadFinance(HttpServletResponse response, String sign, String id) {
  901. Result res = new Result();
  902. User curUser = TokenManager.getUserToken();
  903. if (!checkCertify(res, curUser)) {
  904. return res;
  905. }
  906. if (StringUtils.isEmpty(id)) {
  907. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
  908. return res;
  909. }
  910. OrgFinance of = orgFinanceService.selectByPrimaryKey(id);
  911. if (of == null || !curUser.getId().equals(of.getUid())) {
  912. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
  913. return res;
  914. }
  915. AttachmentType attachmentType = AttachmentType.getField(sign);
  916. if (attachmentType == AttachmentType.FINANCE) {
  917. downloadFile(response, of.getFinanceDownloadFileName(), of.getFinanceUrl());
  918. } else {
  919. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  920. }
  921. return res;
  922. }
  923. /**
  924. * 科技成果附件上传
  925. *
  926. * @param req
  927. * @param sign
  928. * @param uid
  929. * @return
  930. */
  931. @RequestMapping(value = "/uploadAchievement", method = RequestMethod.POST)
  932. public Result uploadAchievement(HttpServletRequest req, String sign) {
  933. Result res = new Result();
  934. User curUser = TokenManager.getUserToken();
  935. if (!checkCertify(res, curUser)) {
  936. return res;
  937. }
  938. AttachmentType attachmentType = AttachmentType.getField(sign);
  939. if (attachmentType == AttachmentType.ACHIEVEMENT) {
  940. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  941. } else {
  942. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  943. }
  944. return res;
  945. }
  946. /**
  947. * 科技成果附件下载
  948. *
  949. * @param response
  950. * @param sign
  951. * @param id
  952. * @return
  953. */
  954. @RequestMapping(value = "/downloadAchievement", method = RequestMethod.GET)
  955. public Result downloadAchievement(HttpServletResponse response, String sign, String id) {
  956. Result res = new Result();
  957. User curUser = TokenManager.getUserToken();
  958. if (!checkCertify(res, curUser)) {
  959. return res;
  960. }
  961. if (StringUtils.isEmpty(id)) {
  962. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
  963. return res;
  964. }
  965. OrgTechAchievement ota = orgTechAchievementService.selectByPrimaryKey(id);
  966. if (ota == null || !curUser.getId().equals(ota.getUid())) {
  967. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
  968. return res;
  969. }
  970. AttachmentType attachmentType = AttachmentType.getField(sign);
  971. if (attachmentType == AttachmentType.ACHIEVEMENT) {
  972. downloadFile(response, ota.getEnclosureDownloadFileName(), ota.getEnclosureUrl());
  973. } else {
  974. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  975. }
  976. return res;
  977. }
  978. /**
  979. * 荣誉及其他证明材料上传
  980. *
  981. * @param req
  982. * @param sign
  983. * @param uid
  984. * @return
  985. */
  986. @RequestMapping(value = "/uploadHonor", method = RequestMethod.POST)
  987. public Result uploadHonor(HttpServletRequest req, String sign) {
  988. Result res = new Result();
  989. User curUser = TokenManager.getUserToken();
  990. if (!checkCertify(res, curUser)) {
  991. return res;
  992. }
  993. AttachmentType attachmentType = AttachmentType.getField(sign);
  994. if (attachmentType == AttachmentType.HONOR) {
  995. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  996. } else {
  997. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  998. }
  999. return res;
  1000. }
  1001. /**
  1002. * 荣誉及其他证明材料下载
  1003. *
  1004. * @param response
  1005. * @param sign
  1006. * @param id
  1007. * @return
  1008. */
  1009. @RequestMapping(value = "/downloadHonor", method = RequestMethod.GET)
  1010. public Result downloadHonor(HttpServletResponse response, String sign, String id) {
  1011. Result res = new Result();
  1012. User curUser = TokenManager.getUserToken();
  1013. if (!checkCertify(res, curUser)) {
  1014. return res;
  1015. }
  1016. if (StringUtils.isEmpty(id)) {
  1017. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
  1018. return res;
  1019. }
  1020. OrgHonorDatum ohd = orgHonorDatumService.selectByPrimaryKey(id);
  1021. if (ohd == null || !curUser.getId().equals(ohd.getUid())) {
  1022. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
  1023. return res;
  1024. }
  1025. AttachmentType attachmentType = AttachmentType.getField(sign);
  1026. if (attachmentType == AttachmentType.HONOR) {
  1027. downloadFile(response, ohd.getEnclosureDownloadFileName(), ohd.getEnclosureUrl());
  1028. } else {
  1029. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1030. }
  1031. return res;
  1032. }
  1033. /**
  1034. * 研发部门制度上传
  1035. *
  1036. * @param req
  1037. * @param sign
  1038. * @param uid
  1039. * @return
  1040. */
  1041. @RequestMapping(value = "/uploadInstitution", method = RequestMethod.POST)
  1042. public Result uploadInstitution(HttpServletRequest req, String sign) {
  1043. Result res = new Result();
  1044. User curUser = TokenManager.getUserToken();
  1045. if (!checkCertify(res, curUser)) {
  1046. return res;
  1047. }
  1048. AttachmentType attachmentType = AttachmentType.getField(sign);
  1049. if (attachmentType == AttachmentType.INSTITUTION) {
  1050. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  1051. } else {
  1052. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1053. }
  1054. return res;
  1055. }
  1056. /**
  1057. * 研发部门制度下载
  1058. *
  1059. * @param response
  1060. * @param sign
  1061. * @param id
  1062. * @return
  1063. */
  1064. @RequestMapping(value = "/downloadInstitution", method = RequestMethod.GET)
  1065. public Result downloadInstitution(HttpServletResponse response, String sign, String id) {
  1066. Result res = new Result();
  1067. User curUser = TokenManager.getUserToken();
  1068. if (!checkCertify(res, curUser)) {
  1069. return res;
  1070. }
  1071. if (StringUtils.isEmpty(id)) {
  1072. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
  1073. return res;
  1074. }
  1075. OrgTechCenter otc = orgTechCenterService.selectByPrimaryKey(id);
  1076. if (otc == null || !curUser.getId().equals(otc.getUid())) {
  1077. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
  1078. return res;
  1079. }
  1080. AttachmentType attachmentType = AttachmentType.getField(sign);
  1081. if (attachmentType == AttachmentType.INSTITUTION) {
  1082. downloadFile(response, otc.getSystemDownloadFileName(), otc.getSystemUrl());
  1083. } else {
  1084. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1085. }
  1086. return res;
  1087. }
  1088. /**
  1089. * 产学研技术中心协议上传
  1090. *
  1091. * @param req
  1092. * @param sign
  1093. * @param uid
  1094. * @return
  1095. */
  1096. @RequestMapping(value = "/uploadProtocol", method = RequestMethod.POST)
  1097. public Result uploadProtocol(HttpServletRequest req, String sign) {
  1098. Result res = new Result();
  1099. User curUser = TokenManager.getUserToken();
  1100. if (!checkCertify(res, curUser)) {
  1101. return res;
  1102. }
  1103. AttachmentType attachmentType = AttachmentType.getField(sign);
  1104. if (attachmentType == AttachmentType.PROTOCOL) {
  1105. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  1106. } else {
  1107. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1108. }
  1109. return res;
  1110. }
  1111. /**
  1112. * 产学研技术中心协议下载
  1113. *
  1114. * @param response
  1115. * @param sign
  1116. * @param id
  1117. * @return
  1118. */
  1119. @RequestMapping(value = "/downloadProtocol", method = RequestMethod.GET)
  1120. public Result downloadProtocol(HttpServletResponse response, String sign, String id) {
  1121. Result res = new Result();
  1122. User curUser = TokenManager.getUserToken();
  1123. if (!checkCertify(res, curUser)) {
  1124. return res;
  1125. }
  1126. if (StringUtils.isEmpty(id)) {
  1127. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
  1128. return res;
  1129. }
  1130. OrgTechCenterDetail otcd = orgTechCenterDetailService.selectByPrimaryKey(id);
  1131. if (otcd == null) {
  1132. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
  1133. return res;
  1134. }
  1135. OrgTechCenter otc = orgTechCenterService.selectByPrimaryKey(otcd.getCid());
  1136. if (otc == null || !curUser.getId().equals(otc.getUid())) {
  1137. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
  1138. return res;
  1139. }
  1140. AttachmentType attachmentType = AttachmentType.getField(sign);
  1141. if (attachmentType == AttachmentType.PROTOCOL) {
  1142. downloadFile(response, otcd.getProtocolDownloadFileName(), otcd.getProtocolUrl());
  1143. } else {
  1144. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1145. }
  1146. return res;
  1147. }
  1148. /**
  1149. * 企业研究开发活动情况表入口
  1150. *
  1151. * @param activityNumber
  1152. * @param activityName
  1153. * @param startDate
  1154. * @param endDate
  1155. * @param pageNo
  1156. * @param pageSize
  1157. * @return
  1158. * @throws ParseException
  1159. */
  1160. @RequestMapping(value = "/activityList", method = RequestMethod.POST)
  1161. public Result activityList(String activityNumber, String activityName, String startDateFormattedDate,
  1162. String endDateFormattedDate, String pageNo, String pageSize) throws ParseException {
  1163. Result res = new Result();
  1164. if (!checkUserLogin(res)) {
  1165. return res;
  1166. }
  1167. Integer pNo = 1;
  1168. Integer pSize = 10;
  1169. if (StringUtils.isNumeric(pageSize)) {
  1170. pSize = Integer.parseInt(pageSize);
  1171. }
  1172. if (StringUtils.isNumeric(pageNo)) {
  1173. pNo = Integer.parseInt(pageNo);
  1174. }
  1175. res.setData(orgActivityService.listOrgActivity(activityNumber, activityName, startDateFormattedDate,
  1176. endDateFormattedDate, pNo, pSize, TokenManager.getUserId()));
  1177. return res;
  1178. }
  1179. /**
  1180. * 企业研究开发活动情况新增、修改
  1181. *
  1182. * @param orgActivity
  1183. * @return
  1184. * @throws ParseException
  1185. */
  1186. @RequestMapping(value = "/activity", method = RequestMethod.POST)
  1187. public Result activity(@Valid InputOrgActivity orgActivity, BindingResult bindingResult,
  1188. String startDateFormattedDate, String endDateFormattedDate) throws ParseException {
  1189. Result res = new Result();
  1190. if (bindingResult.hasErrors()) {
  1191. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1192. OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1193. return res;
  1194. }
  1195. if (!checkUserLogin(res)) {
  1196. return res;
  1197. }
  1198. User curUser = TokenManager.getUserToken();
  1199. if (!checkCertify(res, curUser)) {
  1200. return res;
  1201. }
  1202. if (!StringUtils.isBlank(startDateFormattedDate)) {
  1203. try {
  1204. orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1205. } catch (ParseException e) {
  1206. }
  1207. }
  1208. if (StringUtils.isBlank(endDateFormattedDate)) {
  1209. try {
  1210. orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1211. } catch (ParseException e) {
  1212. }
  1213. }
  1214. OrgActivity oa = new OrgActivity();
  1215. BeanUtils.copyProperties(orgActivity, oa);
  1216. oa.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1217. if (StringUtils.isBlank(oa.getId())) {
  1218. oa.setId(UUID.randomUUID().toString());
  1219. oa.setUid(TokenManager.getUserId());
  1220. orgActivityService.insert(oa);
  1221. } else {
  1222. orgActivityService.updateOrgActivity(oa);
  1223. }
  1224. res.setData(oa);
  1225. return res;
  1226. }
  1227. /**
  1228. * 企业年度研究开发费用结构明细表列表入口
  1229. *
  1230. * @return
  1231. * @throws ParseException
  1232. */
  1233. @RequestMapping(value = "/activityCostList", method = RequestMethod.POST)
  1234. public Result activityCostList(String activityNumber, String startDateFormattedDate, String endDateFormattedDate,
  1235. String pageNo, String pageSize, Integer year) throws ParseException {
  1236. Result res = new Result();
  1237. if (!checkUserLogin(res)) {
  1238. return res;
  1239. }
  1240. Integer pNo = 1;
  1241. Integer pSize = 10;
  1242. if (StringUtils.isNumeric(pageSize)) {
  1243. pSize = Integer.parseInt(pageSize);
  1244. }
  1245. if (StringUtils.isNumeric(pageNo)) {
  1246. pNo = Integer.parseInt(pageNo);
  1247. }
  1248. res.setData(orgActivityCostService.listOrgActivityCost(activityNumber, startDateFormattedDate,
  1249. endDateFormattedDate, pNo, pSize, TokenManager.getUserId(), year));
  1250. return res;
  1251. }
  1252. /**
  1253. * 企业年度研究开发费用结构明细表(新增+修改)
  1254. *
  1255. * @return
  1256. * @throws ParseException
  1257. */
  1258. @RequestMapping(value = "/activityCost", method = RequestMethod.POST)
  1259. public Result activityCost(@Valid InputOrgActivityCost orgActivityCost, BindingResult bindingResult,
  1260. String signDateFormattedDate) throws ParseException {
  1261. Result res = new Result();
  1262. if (bindingResult.hasErrors()) {
  1263. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1264. OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1265. return res;
  1266. }
  1267. if (!checkUserLogin(res)) {
  1268. return res;
  1269. }
  1270. User curUser = TokenManager.getUserToken();
  1271. if (!checkCertify(res, curUser)) {
  1272. return res;
  1273. }
  1274. if (!StringUtils.isBlank(signDateFormattedDate)) {
  1275. orgActivityCost.setSignDate(DateUtils.parseDate(signDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1276. }
  1277. OrgActivityCost oac = new OrgActivityCost();
  1278. BeanUtils.copyProperties(orgActivityCost, oac);
  1279. if (StringUtils.isBlank(oac.getId())) {
  1280. if (null != orgActivityCostService.selectOrgActivityCostByUidAndAid(oac.getAid(),
  1281. TokenManager.getUserId())) {
  1282. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目费用详情已录入!"));
  1283. return res;
  1284. }
  1285. OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(orgActivityCost.getAid());
  1286. oac.setStartDate(ac.getStartDate());
  1287. oac.setEndDate(ac.getEndDate());
  1288. oac.setId(UUID.randomUUID().toString());
  1289. oac.setUid(TokenManager.getUserId());
  1290. oac.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1291. orgActivityCostService.insert(oac);
  1292. } else {
  1293. orgActivityCostService.updateByPrimaryKeySelective(oac);
  1294. }
  1295. return res;
  1296. }
  1297. /**
  1298. * 企业参与国家标准或行业标准制定情况明细入口
  1299. *
  1300. * @return
  1301. */
  1302. @RequestMapping(value = "/standard", method = RequestMethod.POST)
  1303. public Result standard(String standardName, String standardNumber, Integer standardLevel, Integer participateWay,
  1304. String pageNo, String pageSize) {
  1305. Result res = new Result();
  1306. if (!checkUserLogin(res)) {
  1307. return res;
  1308. }
  1309. Integer pNo = 1;
  1310. Integer pSize = 10;
  1311. if (StringUtils.isNumeric(pageSize)) {
  1312. pSize = Integer.parseInt(pageSize);
  1313. }
  1314. if (StringUtils.isNumeric(pageNo)) {
  1315. pNo = Integer.parseInt(pageNo);
  1316. }
  1317. res.setData(orgStandardService.listOrgStandard(standardName, standardNumber, standardLevel, participateWay, pNo,
  1318. pSize, TokenManager.getUserId()));
  1319. return res;
  1320. }
  1321. /**
  1322. * 企业参与国家标准或行业标准制定情况明细修改保存
  1323. *
  1324. * @return
  1325. */
  1326. @RequestMapping(value = "/developStandard", method = RequestMethod.POST)
  1327. public Result developStandard(@Valid InputOrgStandard orgStandard, BindingResult bindingResult) {
  1328. Result res = new Result();
  1329. if (bindingResult.hasErrors()) {
  1330. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1331. OrgStandardFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1332. return res;
  1333. }
  1334. if (null == orgStandard.getYear()) {
  1335. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  1336. return res;
  1337. }
  1338. if (!checkUserLogin(res)) {
  1339. return res;
  1340. }
  1341. User curUser = TokenManager.getUserToken();
  1342. if (!checkCertify(res, curUser)) {
  1343. return res;
  1344. }
  1345. OrgStandard os = new OrgStandard();
  1346. BeanUtils.copyProperties(orgStandard, os);
  1347. if (StringUtils.isBlank(os.getId())) {
  1348. os.setId(UUID.randomUUID().toString());
  1349. os.setUid(TokenManager.getUserId());
  1350. os.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1351. Calendar now = Calendar.getInstance();
  1352. now.set(Calendar.MILLISECOND, 0);
  1353. os.setCreateTime(now.getTime());
  1354. orgStandardService.insert(os);
  1355. } else {
  1356. orgStandardService.updateByPrimaryKeySelective(os);
  1357. }
  1358. res.setData(orgStandard);
  1359. return res;
  1360. }
  1361. /**
  1362. * 上传标准制定附件
  1363. *
  1364. * @param req
  1365. * @param sign
  1366. * @param uid
  1367. * @return
  1368. */
  1369. @RequestMapping(value = "/uploadStandard", method = RequestMethod.POST)
  1370. public Result uploadStandard(HttpServletRequest req, String sign) {
  1371. Result res = new Result();
  1372. User curUser = TokenManager.getUserToken();
  1373. if (!checkCertify(res, curUser)) {
  1374. return res;
  1375. }
  1376. AttachmentType attachmentType = AttachmentType.getField(sign);
  1377. if (attachmentType == AttachmentType.STANDARD) {
  1378. res.setData(handleFiles(res, "/cognizance/", true, req, sign, TokenManager.getUserId()));
  1379. } else {
  1380. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1381. }
  1382. return res;
  1383. }
  1384. /**
  1385. * 下载标准制定
  1386. *
  1387. * @param response
  1388. * @param sign
  1389. * @param id
  1390. * @return
  1391. */
  1392. @RequestMapping(value = "/downloadStandard", method = RequestMethod.GET)
  1393. public Result downloadStandard(HttpServletResponse response, String sign, String id) {
  1394. Result res = new Result();
  1395. User curUser = TokenManager.getUserToken();
  1396. if (!checkCertify(res, curUser)) {
  1397. return res;
  1398. }
  1399. if (StringUtils.isEmpty(id)) {
  1400. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准制定id"));
  1401. return res;
  1402. }
  1403. OrgStandard os = orgStandardService.selectByPrimaryKey(id);
  1404. if (os == null || !curUser.getId().equals(os.getUid())) {
  1405. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准指定id"));
  1406. return res;
  1407. }
  1408. AttachmentType attachmentType = AttachmentType.getField(sign);
  1409. if (attachmentType == AttachmentType.STANDARD) {
  1410. downloadFile(response, os.getStandardDownloadFileName(), os.getEnclosureUrl());
  1411. } else {
  1412. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1413. }
  1414. return res;
  1415. }
  1416. /**
  1417. * 用户端录入+修改知识产权信息(专利+软著)
  1418. *
  1419. * @return
  1420. * @throws ParseException
  1421. */
  1422. @RequestMapping(value = "/intellectual", method = RequestMethod.POST)
  1423. public Result intellectual(@Valid InputOrgIntellectualProperty orgIntellectualProperty, BindingResult bindingResult,
  1424. String authorizationDateFormattedDate) {
  1425. Result res = new Result();
  1426. if (bindingResult.hasErrors()) {
  1427. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1428. OrgIntellectualPropertyFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1429. return res;
  1430. }
  1431. if (!checkUserLogin(res)) {
  1432. return res;
  1433. }
  1434. User curUser = TokenManager.getUserToken();
  1435. if (!checkCertify(res, curUser)) {
  1436. return res;
  1437. }
  1438. if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
  1439. try {
  1440. orgIntellectualProperty.setAuthorizationDate(
  1441. DateUtils.parseDate(authorizationDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1442. } catch (ParseException e) {
  1443. }
  1444. }
  1445. OrgIntellectualProperty oip = new OrgIntellectualProperty();
  1446. BeanUtils.copyProperties(orgIntellectualProperty, oip);
  1447. if (StringUtils.isBlank(oip.getId())) {
  1448. oip.setId(UUID.randomUUID().toString());
  1449. oip.setUid(TokenManager.getUserId());
  1450. oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 1 : 0);
  1451. oip.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1452. res.setData(orgIntellectualPropertyService.insert(oip));
  1453. } else {
  1454. oip.setEvaluationCategory(oip.getCatagory() <= 2 ? 1 : 0);
  1455. res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(oip));
  1456. }
  1457. return res;
  1458. }
  1459. /**
  1460. * 用户知识产权列表
  1461. *
  1462. * @param pageNo
  1463. * @param pageSize
  1464. * @return
  1465. */
  1466. @RequestMapping(value = "/intellectualList", method = RequestMethod.GET)
  1467. public Result intellectualList(String pageNo, String pageSize, String startDate, String endDate) {
  1468. Result res = new Result();
  1469. if (!checkUserLogin(res)) {
  1470. return res;
  1471. }
  1472. Integer pNo = 1;
  1473. Integer pSize = 10;
  1474. if (StringUtils.isNumeric(pageSize)) {
  1475. pSize = Integer.parseInt(pageSize);
  1476. }
  1477. if (StringUtils.isNumeric(pageNo)) {
  1478. pNo = Integer.parseInt(pageNo);
  1479. }
  1480. res.setData(orgIntellectualPropertyService.listIntellectual(pNo, pSize, TokenManager.getUserId(), startDate,
  1481. endDate));
  1482. return res;
  1483. }
  1484. /**
  1485. * 上年度高新技术产品(服务)情况列表
  1486. *
  1487. * @param pageNo
  1488. * @param pageSize
  1489. * @return
  1490. */
  1491. @RequestMapping(value = "/techProductList", method = RequestMethod.GET)
  1492. public Result techProductList(String pageNo, String pageSize) {
  1493. Result res = new Result();
  1494. if (!checkUserLogin(res)) {
  1495. return res;
  1496. }
  1497. Integer pNo = 1;
  1498. Integer pSize = 10;
  1499. if (StringUtils.isNumeric(pageSize)) {
  1500. pSize = Integer.parseInt(pageSize);
  1501. }
  1502. if (StringUtils.isNumeric(pageNo)) {
  1503. pNo = Integer.parseInt(pageNo);
  1504. }
  1505. res.setData(orgTechProductService.listTechProduct(pNo, pSize, TokenManager.getUserId()));
  1506. return res;
  1507. }
  1508. /**
  1509. * 上年度高新技术产品(服务)情况(新增+修改)
  1510. *
  1511. * @param orgTechProduct
  1512. * @return
  1513. */
  1514. @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
  1515. public Result techProduct(@Valid InputOrgTechProduct orgTechProduct, BindingResult bindingResult) {
  1516. Result res = new Result();
  1517. if (bindingResult.hasErrors()) {
  1518. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1519. OrgTechProductFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1520. return res;
  1521. }
  1522. if (!checkUserLogin(res)) {
  1523. return res;
  1524. }
  1525. User curUser = TokenManager.getUserToken();
  1526. if (!checkCertify(res, curUser)) {
  1527. return res;
  1528. }
  1529. OrgTechProduct otp = new OrgTechProduct();
  1530. BeanUtils.copyProperties(orgTechProduct, otp);
  1531. if (StringUtils.isBlank(otp.getId())) {
  1532. otp.setId(UUID.randomUUID().toString());
  1533. otp.setUid(TokenManager.getUserId());
  1534. otp.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1535. Calendar now = Calendar.getInstance();
  1536. now.set(Calendar.MILLISECOND, 0);
  1537. otp.setCreateTime(now.getTime());
  1538. otp.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
  1539. orgTechProductService.insert(otp);
  1540. } else {
  1541. orgTechProductService.updateByPrimaryKeySelective(otp);
  1542. }
  1543. res.setData(otp);
  1544. return res;
  1545. }
  1546. /**
  1547. * 企业纳税申报信息入口
  1548. *
  1549. * @return
  1550. */
  1551. @RequestMapping(value = "/ratepay", method = RequestMethod.GET)
  1552. public Result ratepay(Integer year, String pageNo, String pageSize) {
  1553. Result res = new Result();
  1554. if (!checkUserLogin(res)) {
  1555. return res;
  1556. }
  1557. Integer pNo = 1;
  1558. Integer pSize = 10;
  1559. if (StringUtils.isNumeric(pageSize)) {
  1560. pSize = Integer.parseInt(pageSize);
  1561. }
  1562. if (StringUtils.isNumeric(pageNo)) {
  1563. pNo = Integer.parseInt(pageNo);
  1564. }
  1565. res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, TokenManager.getUserId()));
  1566. return res;
  1567. }
  1568. /**
  1569. * 企业纳税申报信息录入+修改
  1570. */
  1571. @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
  1572. public Result disposeRatepay(@Valid InputOrgRatepay orgRatepay, BindingResult bindingResult) {
  1573. Result res = new Result();
  1574. if (bindingResult.hasErrors()) {
  1575. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1576. OrgRatepayFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1577. return res;
  1578. }
  1579. if (!checkUserLogin(res)) {
  1580. return res;
  1581. }
  1582. User curUser = TokenManager.getUserToken();
  1583. if (!checkCertify(res, curUser)) {
  1584. return res;
  1585. }
  1586. if (null == orgRatepay.getYear()) {
  1587. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1588. return res;
  1589. }
  1590. OrgRatepay rate = new OrgRatepay();
  1591. BeanUtils.copyProperties(orgRatepay, rate);
  1592. if (StringUtils.isBlank(rate.getId())) {
  1593. if (null == orgRatepayService.selectRatepayByUidAndYear(TokenManager.getUserId(), rate.getYear())) {
  1594. rate.setId(UUID.randomUUID().toString());
  1595. rate.setUid(TokenManager.getUserId());
  1596. rate.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1597. orgRatepayService.insert(rate);
  1598. } else {
  1599. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
  1600. return res;
  1601. }
  1602. } else {
  1603. orgRatepayService.updateByPrimaryKeySelective(rate);
  1604. }
  1605. return res;
  1606. }
  1607. /**
  1608. * 财务报表信息入口
  1609. *
  1610. * @return
  1611. */
  1612. @RequestMapping(value = "/finance", method = RequestMethod.GET)
  1613. public Result finance(Integer year, String pageNo, String pageSize) {
  1614. Result res = new Result();
  1615. if (!checkUserLogin(res)) {
  1616. return res;
  1617. }
  1618. Integer pNo = 1;
  1619. Integer pSize = 10;
  1620. if (StringUtils.isNumeric(pageSize)) {
  1621. pSize = Integer.parseInt(pageSize);
  1622. }
  1623. if (StringUtils.isNumeric(pageNo)) {
  1624. pNo = Integer.parseInt(pageNo);
  1625. }
  1626. res.setData(orgFinanceService.listFinance(year, pNo, pSize, TokenManager.getUserId()));
  1627. return res;
  1628. }
  1629. /**
  1630. * 财务报表录入+修改
  1631. *
  1632. * @param orgFinance
  1633. * @return
  1634. */
  1635. @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
  1636. public Result disposeFinance(@Valid InputOrgFinance orgFinance, BindingResult bindingResult) {
  1637. Result res = new Result();
  1638. if (bindingResult.hasErrors()) {
  1639. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1640. OrgFinanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1641. return res;
  1642. }
  1643. if (!checkUserLogin(res)) {
  1644. return res;
  1645. }
  1646. User curUser = TokenManager.getUserToken();
  1647. if (!checkCertify(res, curUser)) {
  1648. return res;
  1649. }
  1650. if (null == orgFinance.getYear()) {
  1651. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1652. return res;
  1653. }
  1654. OrgFinance of = new OrgFinance();
  1655. BeanUtils.copyProperties(orgFinance, of);
  1656. if (StringUtils.isBlank(of.getId())) {
  1657. if (null == orgFinanceService.selectFinanceByUidAndYear(TokenManager.getUserId(), of.getYear())) {
  1658. of.setId(UUID.randomUUID().toString());
  1659. of.setUid(TokenManager.getUserId());
  1660. of.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1661. orgFinanceService.insert(of);
  1662. } else {
  1663. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
  1664. return res;
  1665. }
  1666. } else {
  1667. orgFinanceService.updateByPrimaryKeySelective(of);
  1668. }
  1669. return res;
  1670. }
  1671. /**
  1672. * 获取当前用户已录入项目标号列表
  1673. *
  1674. * @param uid
  1675. * @return
  1676. */
  1677. @RequestMapping(value = "/activityNumber", method = RequestMethod.GET)
  1678. public Result listActivityNumber() {
  1679. Result res = new Result();
  1680. if (!checkUserLogin(res)) {
  1681. return res;
  1682. }
  1683. List<ActivityNumberBo> activityNumberBo = orgActivityService
  1684. .selectOrgActivityNumberBoByUid(TokenManager.getUserId());
  1685. res.setData(activityNumberBo);
  1686. return res;
  1687. }
  1688. /**
  1689. * 高企相关材料上传
  1690. *
  1691. * @param req
  1692. * @param sign
  1693. * @return
  1694. */
  1695. @RequestMapping(value = "/upload", method = RequestMethod.POST)
  1696. public Result cognizanceFile(HttpServletRequest req, String sign, String uid) {
  1697. Result res = new Result();
  1698. if (!checkAdminLogin(res)) {
  1699. return res;
  1700. }
  1701. res.setData(handleFile(res, "/cognizance/", true, req, sign, uid));
  1702. return res;
  1703. }
  1704. /**
  1705. * 科技成果转化情况列表入口
  1706. *
  1707. * @param pageNo
  1708. * @param pageSize
  1709. * @return
  1710. */
  1711. @RequestMapping(value = "/achievementList", method = RequestMethod.GET)
  1712. public Result achievementList(String pageNo, String pageSize) {
  1713. Result res = new Result();
  1714. if (!checkUserLogin(res)) {
  1715. return res;
  1716. }
  1717. Integer pNo = 1;
  1718. Integer pSize = 10;
  1719. if (StringUtils.isNumeric(pageSize)) {
  1720. pSize = Integer.parseInt(pageSize);
  1721. }
  1722. if (StringUtils.isNumeric(pageNo)) {
  1723. pNo = Integer.parseInt(pageNo);
  1724. }
  1725. res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, TokenManager.getUserId()));
  1726. return res;
  1727. }
  1728. /**
  1729. * 科技成果转化情况新增+修改
  1730. *
  1731. * @param achievement
  1732. * @return
  1733. * @throws ParseException
  1734. */
  1735. @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
  1736. public Result disposeAchievement(@Valid InputOrgTechAchievement achievement, BindingResult bindingResult) {
  1737. Result res = new Result();
  1738. if (bindingResult.hasErrors()) {
  1739. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1740. OrgTechAchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1741. return res;
  1742. }
  1743. if (!checkUserLogin(res)) {
  1744. return res;
  1745. }
  1746. User curUser = TokenManager.getUserToken();
  1747. if (!checkCertify(res, curUser)) {
  1748. return res;
  1749. }
  1750. OrgTechAchievement ota = new OrgTechAchievement();
  1751. BeanUtils.copyProperties(achievement, ota);
  1752. if (StringUtils.isBlank(ota.getId())) {
  1753. ota.setId(UUID.randomUUID().toString());
  1754. ota.setUid(TokenManager.getUserId());
  1755. ota.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1756. orgTechAchievementService.insert(ota);
  1757. } else {
  1758. orgTechAchievementService.updateByPrimaryKeySelective(ota);
  1759. }
  1760. return res;
  1761. }
  1762. /**
  1763. * 企业荣誉及其他证明材料列表入口
  1764. *
  1765. * @return
  1766. */
  1767. @RequestMapping(value = "/honorList", method = RequestMethod.GET)
  1768. public Result honorList(String pageNo, String pageSize) {
  1769. Result res = new Result();
  1770. if (!checkUserLogin(res)) {
  1771. return res;
  1772. }
  1773. Integer pNo = 1;
  1774. Integer pSize = 10;
  1775. if (StringUtils.isNumeric(pageSize)) {
  1776. pSize = Integer.parseInt(pageSize);
  1777. }
  1778. if (StringUtils.isNumeric(pageNo)) {
  1779. pNo = Integer.parseInt(pageNo);
  1780. }
  1781. res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, TokenManager.getUserId()));
  1782. return res;
  1783. }
  1784. /**
  1785. * 企业荣誉及其他证明材料新增+修改
  1786. *
  1787. * @param achievement
  1788. * @return
  1789. * @throws ParseException
  1790. */
  1791. @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
  1792. public Result disposeHonor(@Valid InputOrgHonorDatum honor, BindingResult bindingResult,
  1793. String issuingTimeFormattedDate) {
  1794. Result res = new Result();
  1795. if (bindingResult.hasErrors()) {
  1796. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1797. OrgHonorDatumFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1798. return res;
  1799. }
  1800. if (!checkUserLogin(res)) {
  1801. return res;
  1802. }
  1803. User curUser = TokenManager.getUserToken();
  1804. if (!checkCertify(res, curUser)) {
  1805. return res;
  1806. }
  1807. if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
  1808. try {
  1809. honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1810. } catch (ParseException e) {
  1811. }
  1812. }
  1813. if (null == honor.getYear()) {
  1814. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  1815. return res;
  1816. }
  1817. OrgHonorDatum ohd = new OrgHonorDatum();
  1818. BeanUtils.copyProperties(honor, ohd);
  1819. if (StringUtils.isBlank(ohd.getId())) {
  1820. ohd.setId(UUID.randomUUID().toString());
  1821. ohd.setUid(TokenManager.getUserId());
  1822. ohd.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1823. orgHonorDatumService.insert(ohd);
  1824. } else {
  1825. orgHonorDatumService.updateByPrimaryKeySelective(ohd);
  1826. }
  1827. return res;
  1828. }
  1829. /**
  1830. * 技术中心入口
  1831. *
  1832. * @return
  1833. */
  1834. @RequestMapping(value = "/center", method = RequestMethod.GET)
  1835. public Result center() {
  1836. Result res = new Result();
  1837. if (!checkUserLogin(res)) {
  1838. return res;
  1839. }
  1840. User curUser = TokenManager.getUserToken();
  1841. if (!checkCertify(res, curUser)) {
  1842. return res;
  1843. }
  1844. res.setData(orgTechCenterService.selectOrgTechCenterByUid(TokenManager.getUserId()));
  1845. return res;
  1846. }
  1847. /**
  1848. * 技术中心新增+修改
  1849. *
  1850. * @return
  1851. * @throws ParseException
  1852. */
  1853. @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
  1854. public Result disposeCenter(@Valid InputOrgTechCenter orgTechCenter, BindingResult bindingResult,
  1855. String foundingTimeFormattedDate) {
  1856. Result res = new Result();
  1857. if (bindingResult.hasErrors()) {
  1858. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1859. OrgTechCenterFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1860. return res;
  1861. }
  1862. User curUser = TokenManager.getUserToken();
  1863. if (!checkCertify(res, curUser)) {
  1864. return res;
  1865. }
  1866. if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
  1867. try {
  1868. orgTechCenter.setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, AFTConstants.YYYYMMDD));
  1869. } catch (ParseException e) {
  1870. }
  1871. }
  1872. OrgTechCenter otc = new OrgTechCenter();
  1873. BeanUtils.copyProperties(orgTechCenter, otc);
  1874. if (StringUtils.isBlank(otc.getId())) {
  1875. otc.setId(UUID.randomUUID().toString());
  1876. otc.setUid(TokenManager.getUserId());
  1877. otc.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1878. orgTechCenterService.insert(otc);
  1879. } else {
  1880. orgTechCenterService.updateByPrimaryKeySelective(otc);
  1881. }
  1882. return res;
  1883. }
  1884. /**
  1885. * 技术中心明细列表入口
  1886. *
  1887. * @return
  1888. */
  1889. @RequestMapping(value = "/centerDetail", method = RequestMethod.POST)
  1890. public Result centerDetail(String pageNo, String pageSize, String cid) {
  1891. Result res = new Result();
  1892. if (!checkUserLogin(res)) {
  1893. return res;
  1894. }
  1895. User curUser = TokenManager.getUserToken();
  1896. if (!checkCertify(res, curUser)) {
  1897. return res;
  1898. }
  1899. Integer pNo = 1;
  1900. Integer pSize = 10;
  1901. if (StringUtils.isNumeric(pageSize)) {
  1902. pSize = Integer.parseInt(pageSize);
  1903. }
  1904. if (StringUtils.isNumeric(pageNo)) {
  1905. pNo = Integer.parseInt(pageNo);
  1906. }
  1907. res.setData(orgTechCenterDetailService.listOrgTechCenterDetail(pNo, pSize, cid));
  1908. return res;
  1909. }
  1910. /**
  1911. * 技术中心明细新增+修改
  1912. *
  1913. * @param orgTechCenterDetail
  1914. * @param projectTimeFormattedDate
  1915. * @param termTimeFormattedDate
  1916. * @return
  1917. * @throws ParseException
  1918. */
  1919. @RequestMapping(value = "/disposeCenterDetail", method = RequestMethod.POST)
  1920. public Result disposeCenterDetail(@Valid InputOrgTechCenterDetail orgTechCenterDetail, BindingResult bindingResult,
  1921. String projectTimeFormattedDate, String termStartTimeFormattedDate, String termEndTimeFormattedDate) {
  1922. Result res = new Result();
  1923. if (bindingResult.hasErrors()) {
  1924. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1925. OrgTechCenterDetailFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1926. return res;
  1927. }
  1928. User curUser = TokenManager.getUserToken();
  1929. if (!checkCertify(res, curUser)) {
  1930. return res;
  1931. }
  1932. if (StringUtils.isBlank(orgTechCenterDetail.getCid())) {
  1933. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "研发部门相关信息未保存,无法保存!"));
  1934. return res;
  1935. }
  1936. if (!StringUtils.isBlank(projectTimeFormattedDate)) {
  1937. try {
  1938. orgTechCenterDetail
  1939. .setProjectTime(DateUtils.parseDate(projectTimeFormattedDate, AFTConstants.YYYYMMDD));
  1940. } catch (ParseException e) {
  1941. }
  1942. }
  1943. if (!StringUtils.isBlank(termStartTimeFormattedDate)) {
  1944. try {
  1945. orgTechCenterDetail
  1946. .setTermStartTime(DateUtils.parseDate(termStartTimeFormattedDate, AFTConstants.YYYYMMDD));
  1947. } catch (ParseException e) {
  1948. }
  1949. }
  1950. if (!StringUtils.isBlank(termEndTimeFormattedDate)) {
  1951. try {
  1952. orgTechCenterDetail
  1953. .setTermEndTime(DateUtils.parseDate(termEndTimeFormattedDate, AFTConstants.YYYYMMDD));
  1954. } catch (ParseException e) {
  1955. }
  1956. }
  1957. OrgTechCenterDetail otcd = new OrgTechCenterDetail();
  1958. BeanUtils.copyProperties(orgTechCenterDetail, otcd);
  1959. if (StringUtils.isBlank(otcd.getId())) {
  1960. otcd.setId(UUID.randomUUID().toString());
  1961. otcd.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  1962. orgTechCenterDetailService.insert(otcd);
  1963. } else {
  1964. orgTechCenterDetailService.updateByPrimaryKeySelective(otcd);
  1965. }
  1966. return res;
  1967. }
  1968. /**
  1969. * 获取公司联系人
  1970. *
  1971. * @return
  1972. */
  1973. @RequestMapping(value = "/getContacts", method = RequestMethod.GET)
  1974. public Result getContacts() {
  1975. Result res = new Result();
  1976. res.setData(organizationIdentityService.selectContactsByUserId(TokenManager.getUserId()));
  1977. return res;
  1978. }
  1979. /**
  1980. * 高企认定列表入口
  1981. *
  1982. */
  1983. @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
  1984. public Result listCognizance(String contractId, Integer locationProvince, String pageNo, String pageSize) {
  1985. Result res = new Result();
  1986. if (!checkUserLogin(res)) {
  1987. return res;
  1988. }
  1989. User curUser = TokenManager.getUserToken();
  1990. if (!checkCertify(res, curUser)) {
  1991. return res;
  1992. }
  1993. Integer pNo = 1;
  1994. Integer pSize = 10;
  1995. if (StringUtils.isNumeric(pageSize)) {
  1996. pSize = Integer.parseInt(pageSize);
  1997. }
  1998. if (StringUtils.isNumeric(pageNo)) {
  1999. pNo = Integer.parseInt(pageNo);
  2000. }
  2001. res.setData(orgCognizanceService.listCognizance(contractId, TokenManager.getUserId(), null, locationProvince,
  2002. pNo, pSize));
  2003. return res;
  2004. }
  2005. /**
  2006. * 申请高企认定
  2007. *
  2008. * @return
  2009. */
  2010. @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
  2011. public Result applyCognizance(@Valid InputApplyCognizance cog, BindingResult bindingResult) {
  2012. Result res = new Result();
  2013. if (bindingResult.hasErrors()) {
  2014. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2015. CognizanceApplyFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2016. return res;
  2017. }
  2018. if (!checkUserLogin(res)) {
  2019. return res;
  2020. }
  2021. User curUser = TokenManager.getUserToken();
  2022. if (!checkCertify(res, curUser)) {
  2023. return res;
  2024. }
  2025. if (null == cog.getYear()) {
  2026. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2027. return res;
  2028. }
  2029. Integer latelyYear = orgCognizanceService.selectLatelyRecordYear(cog.getUid());
  2030. if (null != latelyYear && cog.getYear() - latelyYear < 4) {
  2031. res.getError()
  2032. .add(buildError(ErrorConstants.STATUS_ERROR, "高企认定申请中或认定未到期!无法提交新申请!", "高企认定申请中或认定未到期!无法提交新申请!"));
  2033. return res;
  2034. }
  2035. OrgCognizance oc = new OrgCognizance();
  2036. BeanUtils.copyProperties(cog, oc);
  2037. oc.setUid(TokenManager.getUserId());
  2038. orgCognizanceService.insertCognizance(oc, curUser.getAid());
  2039. return res;
  2040. }
  2041. /**
  2042. * 高企认定详情入口
  2043. *
  2044. * @param uid
  2045. * @param cid
  2046. * @return
  2047. */
  2048. @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
  2049. public Result cognizanceDetail(String cid, Integer year) {
  2050. Result res = new Result();
  2051. if (!checkUserLogin(res)) {
  2052. return res;
  2053. }
  2054. User curUser = TokenManager.getUserToken();
  2055. if (!checkCertify(res, curUser)) {
  2056. return res;
  2057. }
  2058. if (StringUtils.isBlank(cid)) {
  2059. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2060. return res;
  2061. }
  2062. if (null == year) {
  2063. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2064. return res;
  2065. }
  2066. res.setData(handleCognizanceDetail(TokenManager.getUserId(), cid, year));
  2067. return res;
  2068. }
  2069. /**
  2070. * 高企认定流转状态
  2071. *
  2072. * @param cid
  2073. * @return
  2074. */
  2075. @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
  2076. public Result cognizanceLog(String cid) {
  2077. Result res = new Result();
  2078. if (!checkUserLogin(res)) {
  2079. return res;
  2080. }
  2081. if (StringUtils.isBlank(cid)) {
  2082. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2083. return res;
  2084. }
  2085. List<OrgCognizanceLog> list = orgCognizanceLogService.selectOrgCognizanceLogByCid(cid);
  2086. for (OrgCognizanceLog log : list) {
  2087. if (OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.SIGN
  2088. || OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.CIRCULATION
  2089. || OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.SETTLEMENT) {
  2090. list.remove(log);
  2091. }
  2092. }
  2093. res.setData(list);
  2094. return res;
  2095. }
  2096. /**
  2097. * 保存高企认定详情
  2098. */
  2099. @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
  2100. public Result disposeCognizanceDetail(@Valid InputOrgCognizance cog, BindingResult bindingResult) {
  2101. Result res = new Result();
  2102. if (bindingResult.hasErrors()) {
  2103. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2104. OrgCognizanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2105. return res;
  2106. }
  2107. if (!checkUserLogin(res)) {
  2108. return res;
  2109. }
  2110. User curUser = TokenManager.getUserToken();
  2111. if (!checkCertify(res, curUser)) {
  2112. return res;
  2113. }
  2114. if (StringUtils.isBlank(cog.getId())) {
  2115. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2116. return res;
  2117. }
  2118. OrgCognizance o = orgCognizanceService.selectByPrimaryKey(cog.getId());
  2119. if (null == o) {
  2120. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2121. return res;
  2122. }
  2123. if (OrgCognizanceStatus.CALLBACK.getCode() == o.getState()) {
  2124. res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
  2125. return res;
  2126. }
  2127. if (OrgCognizanceStatus.SETTLEMENT.getCode() == o.getState()) {
  2128. res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
  2129. return res;
  2130. }
  2131. OrgCognizance oc = new OrgCognizance();
  2132. BeanUtils.copyProperties(cog, oc);
  2133. orgCognizanceService.updateByPrimaryKeySelective(oc);
  2134. return res;
  2135. }
  2136. /**
  2137. * 年报列表
  2138. *
  2139. * @return
  2140. */
  2141. @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
  2142. public Result annualReport(Integer year, Integer state, String pageSize, String pageNo) {
  2143. Result res = new Result();
  2144. if (!checkUserLogin(res)) {
  2145. return res;
  2146. }
  2147. User curUser = TokenManager.getUserToken();
  2148. if (!checkCertify(res, curUser)) {
  2149. return res;
  2150. }
  2151. Integer pNo = 1;
  2152. Integer pSize = 10;
  2153. if (StringUtils.isNumeric(pageSize)) {
  2154. pSize = Integer.parseInt(pageSize);
  2155. }
  2156. if (StringUtils.isNumeric(pageNo)) {
  2157. pNo = Integer.parseInt(pageNo);
  2158. }
  2159. res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, TokenManager.getUserId()));
  2160. return res;
  2161. }
  2162. /**
  2163. * 企业年报详情
  2164. *
  2165. * @param uid
  2166. * @param year
  2167. * @return
  2168. */
  2169. @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
  2170. public Result annualReportDetail(Integer year) {
  2171. Result res = new Result();
  2172. if (!checkUserLogin(res)) {
  2173. return res;
  2174. }
  2175. User curUser = TokenManager.getUserToken();
  2176. if (!checkCertify(res, curUser)) {
  2177. return res;
  2178. }
  2179. if (null == year) {
  2180. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2181. return res;
  2182. }
  2183. res.setData(handleAnnualReport(TokenManager.getUserId(), year));
  2184. return res;
  2185. }
  2186. /**
  2187. * 高企年报新增+修改
  2188. *
  2189. * @param orgAnnualReport
  2190. * @return
  2191. */
  2192. @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
  2193. public Result disposeAnnualReport(@Valid InputOrgAnnualReport orgAnnualReport, BindingResult bindingResult) {
  2194. Result res = new Result();
  2195. if (bindingResult.hasErrors()) {
  2196. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2197. OrgAnnualReportFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2198. return res;
  2199. }
  2200. if (!checkUserLogin(res)) {
  2201. return res;
  2202. }
  2203. User curUser = TokenManager.getUserToken();
  2204. if (!checkCertify(res, curUser)) {
  2205. return res;
  2206. }
  2207. OrgAnnualReport oar = new OrgAnnualReport();
  2208. BeanUtils.copyProperties(orgAnnualReport, oar);
  2209. if (StringUtils.isBlank(oar.getId())) {
  2210. if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(oar.getYear(),
  2211. TokenManager.getUserId())) {
  2212. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
  2213. return res;
  2214. }
  2215. oar.setId(UUID.randomUUID().toString());
  2216. oar.setUid(TokenManager.getUserId());
  2217. Calendar now = Calendar.getInstance();
  2218. now.set(Calendar.MILLISECOND, 0);
  2219. oar.setCreateTime(now.getTime());
  2220. oar.setLastUpdateTime(oar.getCreateTime());
  2221. oar.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  2222. orgAnnualReportService.insert(oar);
  2223. } else {
  2224. Calendar now = Calendar.getInstance();
  2225. now.set(Calendar.MILLISECOND, 0);
  2226. oar.setLastUpdateTime(now.getTime());
  2227. orgAnnualReportService.updateByPrimaryKeySelective(oar);
  2228. }
  2229. return res;
  2230. }
  2231. private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign,
  2232. String uid) {
  2233. List<MultipartFile> files = getFiles(req);
  2234. MultipartFile mf = files.get(0);
  2235. String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path,
  2236. StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
  2237. if (!files.isEmpty()) {
  2238. try {
  2239. mf.transferTo(toPrivateFile(fileName));
  2240. LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
  2241. } catch (IllegalStateException | IOException e) {
  2242. LoggerUtils.error(getClass(), "文件上传失败", e);
  2243. res.getError().add(buildError("", "文件上传失败!"));
  2244. return "";
  2245. }
  2246. } else {
  2247. res.getError().add(buildError("", "文件上传失败!"));
  2248. return "";
  2249. }
  2250. return fileName;
  2251. }
  2252. // 判断用户是否通过认证
  2253. /*
  2254. * private Result checkCertify(Result res) { OrganizationIdentity o =
  2255. * organizationIdentityService.selectOrgIdentityByUserId(TokenManager.
  2256. * getUserId()); if (null == o || 5 != o.getAuditStatus()) {
  2257. * res.getError().add(buildError(ErrorConstants.NON_CERTIFIED,
  2258. * "未通过实名认证,无法操作!")); } return res; }
  2259. */
  2260. // 高企认定
  2261. private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
  2262. return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
  2263. }
  2264. // 年报详情
  2265. private AnnualReportBo handleAnnualReport(String uid, Integer year) {
  2266. return orgAnnualReportService.selectAnnualReportBo(uid, year);
  2267. }
  2268. }