CognizanceApiController.java 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602
  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.LatelyCogRecord;
  40. import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
  41. import com.goafanti.cognizance.service.OrgActivityCostService;
  42. import com.goafanti.cognizance.service.OrgActivityService;
  43. import com.goafanti.cognizance.service.OrgAnnualReportService;
  44. import com.goafanti.cognizance.service.OrgCognizanceLogService;
  45. import com.goafanti.cognizance.service.OrgCognizanceService;
  46. import com.goafanti.cognizance.service.OrgFinanceService;
  47. import com.goafanti.cognizance.service.OrgHonorDatumService;
  48. import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
  49. import com.goafanti.cognizance.service.OrgRatepayService;
  50. import com.goafanti.cognizance.service.OrgStandardService;
  51. import com.goafanti.cognizance.service.OrgTechAchievementService;
  52. import com.goafanti.cognizance.service.OrgTechCenterDetailService;
  53. import com.goafanti.cognizance.service.OrgTechCenterService;
  54. import com.goafanti.cognizance.service.OrgTechProductService;
  55. import com.goafanti.common.bo.Result;
  56. import com.goafanti.common.constant.AFTConstants;
  57. import com.goafanti.common.constant.ErrorConstants;
  58. import com.goafanti.common.controller.CertifyApiController;
  59. import com.goafanti.common.enums.AttachmentType;
  60. import com.goafanti.common.enums.CognizanceApplyFields;
  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.common.utils.TimeUtils;
  98. import com.goafanti.copyright.bo.CopyrightInfoDetail;
  99. import com.goafanti.copyright.service.CopyrightInfoService;
  100. import com.goafanti.core.shiro.token.TokenManager;
  101. import com.goafanti.patent.service.PatentInfoService;
  102. import com.goafanti.user.service.OrgHumanResourceService;
  103. import com.goafanti.user.service.OrganizationIdentityService;
  104. import com.goafanti.user.service.UserService;
  105. @Controller
  106. @RequestMapping(value = "/api/user/cognizance")
  107. public class CognizanceApiController extends CertifyApiController {
  108. @Resource
  109. private UserService userService;
  110. @Resource
  111. private OrgStandardService orgStandardService;
  112. @Resource
  113. private OrgActivityService orgActivityService;
  114. @Resource
  115. private OrgIntellectualPropertyService orgIntellectualPropertyService;
  116. @Resource
  117. private OrganizationIdentityService organizationIdentityService;
  118. @Resource
  119. private OrgTechProductService orgTechProductService;
  120. @Resource
  121. private OrgActivityCostService orgActivityCostService;
  122. @Resource
  123. private OrgRatepayService orgRatepayService;
  124. @Resource
  125. private OrgFinanceService orgFinanceService;
  126. @Resource
  127. private OrgTechAchievementService orgTechAchievementService;
  128. @Resource
  129. private OrgHonorDatumService orgHonorDatumService;
  130. @Resource
  131. private OrgTechCenterService orgTechCenterService;
  132. @Resource
  133. private OrgTechCenterDetailService orgTechCenterDetailService;
  134. @Resource
  135. private OrgCognizanceService orgCognizanceService;
  136. @Resource
  137. private OrgAnnualReportService orgAnnualReportService;
  138. @Resource
  139. private OrgCognizanceLogService orgCognizanceLogService;
  140. @Resource
  141. private OrgHumanResourceService orgHumanResourceService;
  142. @Resource
  143. private PatentInfoService patentInfoService;
  144. @Resource
  145. private CopyrightInfoService copyrightInfoService;
  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(0);
  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(0);
  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(0);
  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(0);
  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, endDate));
  1481. return res;
  1482. }
  1483. /**
  1484. * 上年度高新技术产品(服务)情况列表
  1485. *
  1486. * @param pageNo
  1487. * @param pageSize
  1488. * @return
  1489. */
  1490. @RequestMapping(value = "/techProductList", method = RequestMethod.GET)
  1491. public Result techProductList(String pageNo, String pageSize) {
  1492. Result res = new Result();
  1493. if (!checkUserLogin(res)) {
  1494. return res;
  1495. }
  1496. Integer pNo = 1;
  1497. Integer pSize = 10;
  1498. if (StringUtils.isNumeric(pageSize)) {
  1499. pSize = Integer.parseInt(pageSize);
  1500. }
  1501. if (StringUtils.isNumeric(pageNo)) {
  1502. pNo = Integer.parseInt(pageNo);
  1503. }
  1504. res.setData(orgTechProductService.listTechProduct(pNo, pSize, TokenManager.getUserId()));
  1505. return res;
  1506. }
  1507. /**
  1508. * 上年度高新技术产品(服务)情况(新增+修改)
  1509. *
  1510. * @param orgTechProduct
  1511. * @return
  1512. */
  1513. @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
  1514. public Result techProduct(@Valid InputOrgTechProduct orgTechProduct, BindingResult bindingResult) {
  1515. Result res = new Result();
  1516. if (bindingResult.hasErrors()) {
  1517. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1518. OrgTechProductFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1519. return res;
  1520. }
  1521. if (!checkUserLogin(res)) {
  1522. return res;
  1523. }
  1524. User curUser = TokenManager.getUserToken();
  1525. if (!checkCertify(res, curUser)) {
  1526. return res;
  1527. }
  1528. OrgTechProduct otp = new OrgTechProduct();
  1529. BeanUtils.copyProperties(orgTechProduct, otp);
  1530. if (StringUtils.isBlank(otp.getId())) {
  1531. otp.setId(UUID.randomUUID().toString());
  1532. otp.setUid(TokenManager.getUserId());
  1533. otp.setDeletedSign(0);
  1534. Calendar now = Calendar.getInstance();
  1535. now.set(Calendar.MILLISECOND, 0);
  1536. otp.setCreateTime(now.getTime());
  1537. otp.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
  1538. orgTechProductService.insert(otp);
  1539. } else {
  1540. orgTechProductService.updateByPrimaryKeySelective(otp);
  1541. }
  1542. res.setData(otp);
  1543. return res;
  1544. }
  1545. /**
  1546. * 企业纳税申报信息入口
  1547. *
  1548. * @return
  1549. */
  1550. @RequestMapping(value = "/ratepay", method = RequestMethod.GET)
  1551. public Result ratepay(Integer year, String pageNo, String pageSize) {
  1552. Result res = new Result();
  1553. if (!checkUserLogin(res)) {
  1554. return res;
  1555. }
  1556. Integer pNo = 1;
  1557. Integer pSize = 10;
  1558. if (StringUtils.isNumeric(pageSize)) {
  1559. pSize = Integer.parseInt(pageSize);
  1560. }
  1561. if (StringUtils.isNumeric(pageNo)) {
  1562. pNo = Integer.parseInt(pageNo);
  1563. }
  1564. res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, TokenManager.getUserId()));
  1565. return res;
  1566. }
  1567. /**
  1568. * 企业纳税申报信息录入+修改
  1569. */
  1570. @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
  1571. public Result disposeRatepay(@Valid InputOrgRatepay orgRatepay, BindingResult bindingResult) {
  1572. Result res = new Result();
  1573. if (bindingResult.hasErrors()) {
  1574. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1575. OrgRatepayFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1576. return res;
  1577. }
  1578. if (!checkUserLogin(res)) {
  1579. return res;
  1580. }
  1581. User curUser = TokenManager.getUserToken();
  1582. if (!checkCertify(res, curUser)) {
  1583. return res;
  1584. }
  1585. if (null == orgRatepay.getYear()) {
  1586. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1587. return res;
  1588. }
  1589. OrgRatepay rate = new OrgRatepay();
  1590. BeanUtils.copyProperties(orgRatepay, rate);
  1591. if (StringUtils.isBlank(rate.getId())) {
  1592. if (null == orgRatepayService.selectRatepayByUidAndYear(TokenManager.getUserId(), rate.getYear())) {
  1593. rate.setId(UUID.randomUUID().toString());
  1594. rate.setUid(TokenManager.getUserId());
  1595. rate.setDeletedSign(0);
  1596. orgRatepayService.insert(rate);
  1597. } else {
  1598. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
  1599. return res;
  1600. }
  1601. } else {
  1602. orgRatepayService.updateByPrimaryKeySelective(rate);
  1603. }
  1604. return res;
  1605. }
  1606. /**
  1607. * 财务报表信息入口
  1608. *
  1609. * @return
  1610. */
  1611. @RequestMapping(value = "/finance", method = RequestMethod.GET)
  1612. public Result finance(Integer year, String pageNo, String pageSize) {
  1613. Result res = new Result();
  1614. if (!checkUserLogin(res)) {
  1615. return res;
  1616. }
  1617. Integer pNo = 1;
  1618. Integer pSize = 10;
  1619. if (StringUtils.isNumeric(pageSize)) {
  1620. pSize = Integer.parseInt(pageSize);
  1621. }
  1622. if (StringUtils.isNumeric(pageNo)) {
  1623. pNo = Integer.parseInt(pageNo);
  1624. }
  1625. res.setData(orgFinanceService.listFinance(year, pNo, pSize, TokenManager.getUserId()));
  1626. return res;
  1627. }
  1628. /**
  1629. * 财务报表录入+修改
  1630. *
  1631. * @param orgFinance
  1632. * @return
  1633. */
  1634. @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
  1635. public Result disposeFinance(@Valid InputOrgFinance orgFinance, BindingResult bindingResult) {
  1636. Result res = new Result();
  1637. if (bindingResult.hasErrors()) {
  1638. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1639. OrgFinanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1640. return res;
  1641. }
  1642. if (!checkUserLogin(res)) {
  1643. return res;
  1644. }
  1645. User curUser = TokenManager.getUserToken();
  1646. if (!checkCertify(res, curUser)) {
  1647. return res;
  1648. }
  1649. if (null == orgFinance.getYear()) {
  1650. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1651. return res;
  1652. }
  1653. OrgFinance of = new OrgFinance();
  1654. BeanUtils.copyProperties(orgFinance, of);
  1655. if (StringUtils.isBlank(of.getId())) {
  1656. if (null == orgFinanceService.selectFinanceByUidAndYear(TokenManager.getUserId(), of.getYear())) {
  1657. of.setId(UUID.randomUUID().toString());
  1658. of.setUid(TokenManager.getUserId());
  1659. of.setDeletedSign(0);
  1660. orgFinanceService.insert(of);
  1661. } else {
  1662. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
  1663. return res;
  1664. }
  1665. } else {
  1666. orgFinanceService.updateByPrimaryKeySelective(of);
  1667. }
  1668. return res;
  1669. }
  1670. /**
  1671. * 获取当前用户已录入项目标号列表
  1672. *
  1673. * @param uid
  1674. * @return
  1675. */
  1676. @RequestMapping(value = "/activityNumber", method = RequestMethod.GET)
  1677. public Result listActivityNumber() {
  1678. Result res = new Result();
  1679. if (!checkUserLogin(res)) {
  1680. return res;
  1681. }
  1682. List<ActivityNumberBo> activityNumberBo = orgActivityService
  1683. .selectOrgActivityNumberBoByUid(TokenManager.getUserId());
  1684. res.setData(activityNumberBo);
  1685. return res;
  1686. }
  1687. /**
  1688. * 高企相关材料上传
  1689. *
  1690. * @param req
  1691. * @param sign
  1692. * @return
  1693. */
  1694. @RequestMapping(value = "/upload", method = RequestMethod.POST)
  1695. public Result cognizanceFile(HttpServletRequest req, String sign, String uid) {
  1696. Result res = new Result();
  1697. if (!checkAdminLogin(res)) {
  1698. return res;
  1699. }
  1700. res.setData(handleFile(res, "/cognizance/", true, req, sign, uid));
  1701. return res;
  1702. }
  1703. /**
  1704. * 科技成果转化情况列表入口
  1705. *
  1706. * @param pageNo
  1707. * @param pageSize
  1708. * @return
  1709. */
  1710. @RequestMapping(value = "/achievementList", method = RequestMethod.GET)
  1711. public Result achievementList(String pageNo, String pageSize) {
  1712. Result res = new Result();
  1713. if (!checkUserLogin(res)) {
  1714. return res;
  1715. }
  1716. Integer pNo = 1;
  1717. Integer pSize = 10;
  1718. if (StringUtils.isNumeric(pageSize)) {
  1719. pSize = Integer.parseInt(pageSize);
  1720. }
  1721. if (StringUtils.isNumeric(pageNo)) {
  1722. pNo = Integer.parseInt(pageNo);
  1723. }
  1724. res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, TokenManager.getUserId()));
  1725. return res;
  1726. }
  1727. /**
  1728. * 科技成果转化情况新增+修改
  1729. *
  1730. * @param achievement
  1731. * @return
  1732. * @throws ParseException
  1733. */
  1734. @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
  1735. public Result disposeAchievement(@Valid InputOrgTechAchievement achievement, BindingResult bindingResult) {
  1736. Result res = new Result();
  1737. if (bindingResult.hasErrors()) {
  1738. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1739. OrgTechAchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1740. return res;
  1741. }
  1742. if (!checkUserLogin(res)) {
  1743. return res;
  1744. }
  1745. User curUser = TokenManager.getUserToken();
  1746. if (!checkCertify(res, curUser)) {
  1747. return res;
  1748. }
  1749. OrgTechAchievement ota = new OrgTechAchievement();
  1750. BeanUtils.copyProperties(achievement, ota);
  1751. if (StringUtils.isBlank(ota.getId())) {
  1752. ota.setId(UUID.randomUUID().toString());
  1753. ota.setUid(TokenManager.getUserId());
  1754. ota.setDeletedSign(0);
  1755. orgTechAchievementService.insert(ota);
  1756. } else {
  1757. orgTechAchievementService.updateByPrimaryKeySelective(ota);
  1758. }
  1759. return res;
  1760. }
  1761. /**
  1762. * 企业荣誉及其他证明材料列表入口
  1763. *
  1764. * @return
  1765. */
  1766. @RequestMapping(value = "/honorList", method = RequestMethod.GET)
  1767. public Result honorList(String pageNo, String pageSize) {
  1768. Result res = new Result();
  1769. if (!checkUserLogin(res)) {
  1770. return res;
  1771. }
  1772. Integer pNo = 1;
  1773. Integer pSize = 10;
  1774. if (StringUtils.isNumeric(pageSize)) {
  1775. pSize = Integer.parseInt(pageSize);
  1776. }
  1777. if (StringUtils.isNumeric(pageNo)) {
  1778. pNo = Integer.parseInt(pageNo);
  1779. }
  1780. res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, TokenManager.getUserId()));
  1781. return res;
  1782. }
  1783. /**
  1784. * 企业荣誉及其他证明材料新增+修改
  1785. *
  1786. * @param achievement
  1787. * @return
  1788. * @throws ParseException
  1789. */
  1790. @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
  1791. public Result disposeHonor(@Valid InputOrgHonorDatum honor, BindingResult bindingResult,
  1792. String issuingTimeFormattedDate) {
  1793. Result res = new Result();
  1794. if (bindingResult.hasErrors()) {
  1795. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1796. OrgHonorDatumFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1797. return res;
  1798. }
  1799. if (!checkUserLogin(res)) {
  1800. return res;
  1801. }
  1802. User curUser = TokenManager.getUserToken();
  1803. if (!checkCertify(res, curUser)) {
  1804. return res;
  1805. }
  1806. if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
  1807. try {
  1808. honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1809. } catch (ParseException e) {
  1810. }
  1811. }
  1812. if (null == honor.getYear()) {
  1813. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  1814. return res;
  1815. }
  1816. OrgHonorDatum ohd = new OrgHonorDatum();
  1817. BeanUtils.copyProperties(honor, ohd);
  1818. if (StringUtils.isBlank(ohd.getId())) {
  1819. ohd.setId(UUID.randomUUID().toString());
  1820. ohd.setUid(TokenManager.getUserId());
  1821. ohd.setDeletedSign(0);
  1822. orgHonorDatumService.insert(ohd);
  1823. } else {
  1824. orgHonorDatumService.updateByPrimaryKeySelective(ohd);
  1825. }
  1826. return res;
  1827. }
  1828. /**
  1829. * 技术中心入口
  1830. *
  1831. * @return
  1832. */
  1833. @RequestMapping(value = "/center", method = RequestMethod.GET)
  1834. public Result center() {
  1835. Result res = new Result();
  1836. if (!checkUserLogin(res)) {
  1837. return res;
  1838. }
  1839. User curUser = TokenManager.getUserToken();
  1840. if (!checkCertify(res, curUser)) {
  1841. return res;
  1842. }
  1843. res.setData(orgTechCenterService.selectOrgTechCenterByUid(TokenManager.getUserId()));
  1844. return res;
  1845. }
  1846. /**
  1847. * 技术中心新增+修改
  1848. *
  1849. * @return
  1850. * @throws ParseException
  1851. */
  1852. @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
  1853. public Result disposeCenter(@Valid InputOrgTechCenter orgTechCenter, BindingResult bindingResult,
  1854. String foundingTimeFormattedDate) {
  1855. Result res = new Result();
  1856. if (bindingResult.hasErrors()) {
  1857. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1858. OrgTechCenterFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1859. return res;
  1860. }
  1861. if (!checkUserLogin(res)) {
  1862. return res;
  1863. }
  1864. User curUser = TokenManager.getUserToken();
  1865. if (!checkCertify(res, curUser)) {
  1866. return res;
  1867. }
  1868. if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
  1869. try {
  1870. orgTechCenter
  1871. .setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
  1872. } catch (ParseException e) {
  1873. }
  1874. }
  1875. OrgTechCenter otc = new OrgTechCenter();
  1876. BeanUtils.copyProperties(orgTechCenter, otc);
  1877. if (StringUtils.isBlank(otc.getId())) {
  1878. otc.setId(UUID.randomUUID().toString());
  1879. otc.setUid(TokenManager.getUserId());
  1880. otc.setDeletedSign(0);
  1881. orgTechCenterService.insert(otc);
  1882. } else {
  1883. orgTechCenterService.updateByPrimaryKeySelective(otc);
  1884. }
  1885. return res;
  1886. }
  1887. /**
  1888. * 技术中心明细列表入口
  1889. *
  1890. * @return
  1891. */
  1892. @RequestMapping(value = "/centerDetail", method = RequestMethod.POST)
  1893. public Result centerDetail(String pageNo, String pageSize, String cid) {
  1894. Result res = new Result();
  1895. if (!checkUserLogin(res)) {
  1896. return res;
  1897. }
  1898. User curUser = TokenManager.getUserToken();
  1899. if (!checkCertify(res, curUser)) {
  1900. return res;
  1901. }
  1902. Integer pNo = 1;
  1903. Integer pSize = 10;
  1904. if (StringUtils.isNumeric(pageSize)) {
  1905. pSize = Integer.parseInt(pageSize);
  1906. }
  1907. if (StringUtils.isNumeric(pageNo)) {
  1908. pNo = Integer.parseInt(pageNo);
  1909. }
  1910. res.setData(orgTechCenterDetailService.listOrgTechCenterDetail(pNo, pSize, cid));
  1911. return res;
  1912. }
  1913. /**
  1914. * 技术中心明细新增+修改
  1915. *
  1916. * @param orgTechCenterDetail
  1917. * @param projectTimeFormattedDate
  1918. * @param termTimeFormattedDate
  1919. * @return
  1920. * @throws ParseException
  1921. */
  1922. @RequestMapping(value = "/disposeCenterDetail", method = RequestMethod.POST)
  1923. public Result disposeCenterDetail(@Valid InputOrgTechCenterDetail orgTechCenterDetail, BindingResult bindingResult,
  1924. String projectTimeFormattedDate, String termStartTimeFormattedDate, String termEndTimeFormattedDate) {
  1925. Result res = new Result();
  1926. if (bindingResult.hasErrors()) {
  1927. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1928. OrgTechCenterDetailFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1929. return res;
  1930. }
  1931. if (!checkUserLogin(res)) {
  1932. return res;
  1933. }
  1934. User curUser = TokenManager.getUserToken();
  1935. if (!checkCertify(res, curUser)) {
  1936. return res;
  1937. }
  1938. if (!StringUtils.isBlank(projectTimeFormattedDate)) {
  1939. try {
  1940. orgTechCenterDetail
  1941. .setProjectTime(DateUtils.parseDate(projectTimeFormattedDate, AFTConstants.YYYYMMDD));
  1942. } catch (ParseException e) {
  1943. }
  1944. }
  1945. if (!StringUtils.isBlank(termStartTimeFormattedDate)) {
  1946. try {
  1947. orgTechCenterDetail
  1948. .setTermStartTime(DateUtils.parseDate(termStartTimeFormattedDate, AFTConstants.YYYYMMDD));
  1949. } catch (ParseException e) {
  1950. }
  1951. }
  1952. if (!StringUtils.isBlank(termEndTimeFormattedDate)) {
  1953. try {
  1954. orgTechCenterDetail
  1955. .setTermEndTime(DateUtils.parseDate(termEndTimeFormattedDate, AFTConstants.YYYYMMDD));
  1956. } catch (ParseException e) {
  1957. }
  1958. }
  1959. OrgTechCenterDetail otcd = new OrgTechCenterDetail();
  1960. BeanUtils.copyProperties(orgTechCenterDetail, otcd);
  1961. if (StringUtils.isBlank(otcd.getId())) {
  1962. otcd.setId(UUID.randomUUID().toString());
  1963. otcd.setDeletedSign(0);
  1964. orgTechCenterDetailService.insert(otcd);
  1965. } else {
  1966. orgTechCenterDetailService.updateByPrimaryKeySelective(otcd);
  1967. }
  1968. return res;
  1969. }
  1970. /**
  1971. * 获取公司联系人
  1972. *
  1973. * @return
  1974. */
  1975. @RequestMapping(value = "/getContacts", method = RequestMethod.GET)
  1976. public Result getContacts() {
  1977. Result res = new Result();
  1978. res.setData(organizationIdentityService.selectContactsByUserId(TokenManager.getUserId()));
  1979. return res;
  1980. }
  1981. /**
  1982. * 高企认定列表入口
  1983. *
  1984. * @param locationProvince
  1985. * @param unitName
  1986. * @return
  1987. */
  1988. @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
  1989. public Result listCognizance(String locationProvince, String pageNo, String pageSize) {
  1990. Result res = new Result();
  1991. if (!checkUserLogin(res)) {
  1992. return res;
  1993. }
  1994. User curUser = TokenManager.getUserToken();
  1995. if (!checkCertify(res, curUser)) {
  1996. return res;
  1997. }
  1998. Integer pNo = 1;
  1999. Integer pSize = 10;
  2000. if (StringUtils.isNumeric(pageSize)) {
  2001. pSize = Integer.parseInt(pageSize);
  2002. }
  2003. if (StringUtils.isNumeric(pageNo)) {
  2004. pNo = Integer.parseInt(pageNo);
  2005. }
  2006. res.setData(orgCognizanceService.listCognizance(TokenManager.getUserId(), null, locationProvince, pNo, pSize));
  2007. return res;
  2008. }
  2009. /**
  2010. * 申请高企认定
  2011. *
  2012. * @return
  2013. */
  2014. @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
  2015. public Result applyCognizance(@Valid InputApplyCognizance cog, BindingResult bindingResult) {
  2016. Result res = new Result();
  2017. if (bindingResult.hasErrors()) {
  2018. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2019. CognizanceApplyFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2020. return res;
  2021. }
  2022. if (!checkUserLogin(res)) {
  2023. return res;
  2024. }
  2025. User curUser = TokenManager.getUserToken();
  2026. if (!checkCertify(res, curUser)) {
  2027. return res;
  2028. }
  2029. if (null == cog.getYear()) {
  2030. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2031. return res;
  2032. }
  2033. LatelyCogRecord lcr = orgCognizanceService.selectLatelyRecord(TokenManager.getUserId());
  2034. if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() != lcr.getState()
  2035. && OrgCognizanceStatus.FOSTER.getCode() != lcr.getState()
  2036. && OrgCognizanceStatus.CALLBACK.getCode() != lcr.getState()) {
  2037. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
  2038. return res;
  2039. }
  2040. if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() == lcr.getState()) {
  2041. if (null == lcr.getIssuingDate()) {
  2042. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
  2043. return res;
  2044. }
  2045. try {
  2046. if (Boolean.FALSE == TimeUtils.checkCogExpire(lcr.getIssuingDate())) {
  2047. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企认定未过期,无法提交新申请!"));
  2048. return res;
  2049. }
  2050. } catch (ParseException e) {
  2051. }
  2052. }
  2053. OrgCognizance oc = new OrgCognizance();
  2054. BeanUtils.copyProperties(cog, oc);
  2055. oc.setUid(TokenManager.getUserId());
  2056. orgCognizanceService.insertCognizance(oc, curUser.getAid());
  2057. return res;
  2058. }
  2059. /**
  2060. * 高企认定详情入口
  2061. *
  2062. * @param uid
  2063. * @param cid
  2064. * @return
  2065. */
  2066. @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
  2067. public Result cognizanceDetail(String cid, Integer year) {
  2068. Result res = new Result();
  2069. if (!checkUserLogin(res)) {
  2070. return res;
  2071. }
  2072. User curUser = TokenManager.getUserToken();
  2073. if (!checkCertify(res, curUser)) {
  2074. return res;
  2075. }
  2076. if (StringUtils.isBlank(cid)) {
  2077. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2078. return res;
  2079. }
  2080. if (null == year) {
  2081. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2082. return res;
  2083. }
  2084. res.setData(handleCognizanceDetail(TokenManager.getUserId(), cid, year));
  2085. return res;
  2086. }
  2087. /**
  2088. * 高企认定流转状态
  2089. *
  2090. * @param cid
  2091. * @return
  2092. */
  2093. @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
  2094. public Result cognizanceLog(String cid) {
  2095. Result res = new Result();
  2096. if (!checkUserLogin(res)) {
  2097. return res;
  2098. }
  2099. if (StringUtils.isBlank(cid)) {
  2100. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2101. return res;
  2102. }
  2103. List<OrgCognizanceLog> list = orgCognizanceLogService.selectOrgCognizanceLogByCid(cid);
  2104. for (OrgCognizanceLog log : list) {
  2105. if (OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.SIGN
  2106. || OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.CIRCULATION
  2107. || OrgCognizanceStatus.getStatus(log.getState()) == OrgCognizanceStatus.SETTLEMENT) {
  2108. list.remove(log);
  2109. }
  2110. }
  2111. res.setData(list);
  2112. return res;
  2113. }
  2114. /**
  2115. * 保存高企认定详情
  2116. */
  2117. @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
  2118. public Result disposeCognizanceDetail(@Valid InputOrgCognizance cog, BindingResult bindingResult) {
  2119. Result res = new Result();
  2120. if (bindingResult.hasErrors()) {
  2121. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2122. OrgCognizanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2123. return res;
  2124. }
  2125. if (!checkUserLogin(res)) {
  2126. return res;
  2127. }
  2128. User curUser = TokenManager.getUserToken();
  2129. if (!checkCertify(res, curUser)) {
  2130. return res;
  2131. }
  2132. if (StringUtils.isBlank(cog.getId())) {
  2133. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2134. return res;
  2135. }
  2136. OrgCognizance o = orgCognizanceService.selectByPrimaryKey(cog.getId());
  2137. if (null == o) {
  2138. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2139. return res;
  2140. }
  2141. if (OrgCognizanceStatus.CALLBACK.getCode() == o.getState()) {
  2142. res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
  2143. return res;
  2144. }
  2145. if (OrgCognizanceStatus.SETTLEMENT.getCode() == o.getState()) {
  2146. res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
  2147. return res;
  2148. }
  2149. OrgCognizance oc = new OrgCognizance();
  2150. BeanUtils.copyProperties(cog, oc);
  2151. orgCognizanceService.updateByPrimaryKeySelective(oc);
  2152. return res;
  2153. }
  2154. /**
  2155. * 年报列表
  2156. *
  2157. * @return
  2158. */
  2159. @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
  2160. public Result annualReport(Integer year, Integer state, String pageSize, String pageNo) {
  2161. Result res = new Result();
  2162. if (!checkUserLogin(res)) {
  2163. return res;
  2164. }
  2165. User curUser = TokenManager.getUserToken();
  2166. if (!checkCertify(res, curUser)) {
  2167. return res;
  2168. }
  2169. Integer pNo = 1;
  2170. Integer pSize = 10;
  2171. if (StringUtils.isNumeric(pageSize)) {
  2172. pSize = Integer.parseInt(pageSize);
  2173. }
  2174. if (StringUtils.isNumeric(pageNo)) {
  2175. pNo = Integer.parseInt(pageNo);
  2176. }
  2177. res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, TokenManager.getUserId()));
  2178. return res;
  2179. }
  2180. /**
  2181. * 企业年报详情
  2182. *
  2183. * @param uid
  2184. * @param year
  2185. * @return
  2186. */
  2187. @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
  2188. public Result annualReportDetail(Integer year) {
  2189. Result res = new Result();
  2190. if (!checkUserLogin(res)) {
  2191. return res;
  2192. }
  2193. User curUser = TokenManager.getUserToken();
  2194. if (!checkCertify(res, curUser)) {
  2195. return res;
  2196. }
  2197. if (null == year) {
  2198. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2199. return res;
  2200. }
  2201. res.setData(handleAnnualReport(TokenManager.getUserId(), year));
  2202. return res;
  2203. }
  2204. /**
  2205. * 高企年报新增+修改
  2206. *
  2207. * @param orgAnnualReport
  2208. * @return
  2209. */
  2210. @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
  2211. public Result disposeAnnualReport(@Valid InputOrgAnnualReport orgAnnualReport, BindingResult bindingResult) {
  2212. Result res = new Result();
  2213. if (bindingResult.hasErrors()) {
  2214. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2215. OrgAnnualReportFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2216. return res;
  2217. }
  2218. if (!checkUserLogin(res)) {
  2219. return res;
  2220. }
  2221. User curUser = TokenManager.getUserToken();
  2222. if (!checkCertify(res, curUser)) {
  2223. return res;
  2224. }
  2225. OrgAnnualReport oar = new OrgAnnualReport();
  2226. BeanUtils.copyProperties(orgAnnualReport, oar);
  2227. if (StringUtils.isBlank(oar.getId())) {
  2228. if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(oar.getYear(),
  2229. TokenManager.getUserId())) {
  2230. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
  2231. return res;
  2232. }
  2233. oar.setId(UUID.randomUUID().toString());
  2234. oar.setUid(TokenManager.getUserId());
  2235. Calendar now = Calendar.getInstance();
  2236. now.set(Calendar.MILLISECOND, 0);
  2237. oar.setCreateTime(now.getTime());
  2238. oar.setLastUpdateTime(oar.getCreateTime());
  2239. oar.setDeletedSign(0);
  2240. orgAnnualReportService.insert(oar);
  2241. } else {
  2242. Calendar now = Calendar.getInstance();
  2243. now.set(Calendar.MILLISECOND, 0);
  2244. oar.setLastUpdateTime(now.getTime());
  2245. orgAnnualReportService.updateByPrimaryKeySelective(oar);
  2246. }
  2247. return res;
  2248. }
  2249. private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign,
  2250. String uid) {
  2251. List<MultipartFile> files = getFiles(req);
  2252. MultipartFile mf = files.get(0);
  2253. String fileName = FileUtils.mosaicFileName(mf, isPrivate, sign, path,
  2254. StringUtils.isBlank(uid) ? TokenManager.getUserId() : uid);
  2255. if (!files.isEmpty()) {
  2256. try {
  2257. mf.transferTo(toPrivateFile(fileName));
  2258. LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
  2259. } catch (IllegalStateException | IOException e) {
  2260. LoggerUtils.error(getClass(), "文件上传失败", e);
  2261. res.getError().add(buildError("", "文件上传失败!"));
  2262. return "";
  2263. }
  2264. } else {
  2265. res.getError().add(buildError("", "文件上传失败!"));
  2266. return "";
  2267. }
  2268. return fileName;
  2269. }
  2270. // 判断用户是否通过认证
  2271. /*
  2272. * private Result checkCertify(Result res) { OrganizationIdentity o =
  2273. * organizationIdentityService.selectOrgIdentityByUserId(TokenManager.
  2274. * getUserId()); if (null == o || 5 != o.getAuditStatus()) {
  2275. * res.getError().add(buildError(ErrorConstants.NON_CERTIFIED,
  2276. * "未通过实名认证,无法操作!")); } return res; }
  2277. */
  2278. // 高企认定
  2279. private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
  2280. return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
  2281. }
  2282. // 年报详情
  2283. private AnnualReportBo handleAnnualReport(String uid, Integer year) {
  2284. return orgAnnualReportService.selectAnnualReportBo(uid, year);
  2285. }
  2286. }