CognizanceApiController.java 78 KB

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