CognizanceApiController.java 71 KB

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