AdminApiController.java 115 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558
  1. package com.goafanti.admin.controller;
  2. import java.math.BigDecimal;
  3. import java.text.ParseException;
  4. import java.util.ArrayList;
  5. import java.util.Arrays;
  6. import java.util.Calendar;
  7. import java.util.Date;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.TreeMap;
  12. import java.util.UUID;
  13. import javax.annotation.Resource;
  14. import javax.servlet.http.HttpServletRequest;
  15. import javax.servlet.http.HttpServletResponse;
  16. import javax.validation.Valid;
  17. import org.springframework.beans.BeanUtils;
  18. import org.springframework.stereotype.Controller;
  19. import org.springframework.validation.BindingResult;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RequestParam;
  23. import com.goafanti.admin.bo.AdminDetail;
  24. import com.goafanti.admin.bo.InputAdmin;
  25. import com.goafanti.admin.service.AdminService;
  26. import com.goafanti.cognizance.bo.ActivityNumberBo;
  27. import com.goafanti.cognizance.bo.AnnualReportBo;
  28. import com.goafanti.cognizance.bo.CognizanceDetailBo;
  29. import com.goafanti.cognizance.bo.InputApplyCognizance;
  30. import com.goafanti.cognizance.bo.InputOrgActivity;
  31. import com.goafanti.cognizance.bo.InputOrgActivityCost;
  32. import com.goafanti.cognizance.bo.InputOrgAnnualReport;
  33. import com.goafanti.cognizance.bo.InputOrgCognizance;
  34. import com.goafanti.cognizance.bo.InputOrgFinance;
  35. import com.goafanti.cognizance.bo.InputOrgHonorDatum;
  36. import com.goafanti.cognizance.bo.InputOrgHumanResource;
  37. import com.goafanti.cognizance.bo.InputOrgIntellectualProperty;
  38. import com.goafanti.cognizance.bo.InputOrgRatepay;
  39. import com.goafanti.cognizance.bo.InputOrgStandard;
  40. import com.goafanti.cognizance.bo.InputOrgTechAchievement;
  41. import com.goafanti.cognizance.bo.InputOrgTechCenter;
  42. import com.goafanti.cognizance.bo.InputOrgTechCenterDetail;
  43. import com.goafanti.cognizance.bo.InputOrgTechProduct;
  44. import com.goafanti.cognizance.bo.LatelyCogRecord;
  45. import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
  46. import com.goafanti.cognizance.service.OrgActivityCostService;
  47. import com.goafanti.cognizance.service.OrgActivityService;
  48. import com.goafanti.cognizance.service.OrgAnnualReportService;
  49. import com.goafanti.cognizance.service.OrgCognizanceLogService;
  50. import com.goafanti.cognizance.service.OrgCognizanceProportionService;
  51. import com.goafanti.cognizance.service.OrgCognizanceService;
  52. import com.goafanti.cognizance.service.OrgFinanceService;
  53. import com.goafanti.cognizance.service.OrgHonorDatumService;
  54. import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
  55. import com.goafanti.cognizance.service.OrgRatepayService;
  56. import com.goafanti.cognizance.service.OrgStandardService;
  57. import com.goafanti.cognizance.service.OrgTechAchievementService;
  58. import com.goafanti.cognizance.service.OrgTechCenterDetailService;
  59. import com.goafanti.cognizance.service.OrgTechCenterService;
  60. import com.goafanti.cognizance.service.OrgTechProductService;
  61. import com.goafanti.common.bo.Result;
  62. import com.goafanti.common.constant.AFTConstants;
  63. import com.goafanti.common.constant.ErrorConstants;
  64. import com.goafanti.common.controller.CertifyApiController;
  65. import com.goafanti.common.enums.AdminFields;
  66. import com.goafanti.common.enums.AttachmentType;
  67. import com.goafanti.common.enums.CognizanceApplyFields;
  68. import com.goafanti.common.enums.DeleteStatus;
  69. import com.goafanti.common.enums.FinanceRatepayFields;
  70. import com.goafanti.common.enums.IdentityAuditStatus;
  71. import com.goafanti.common.enums.IdentityProcess;
  72. import com.goafanti.common.enums.IntellectualPropertyType;
  73. import com.goafanti.common.enums.OrgActivityFields;
  74. import com.goafanti.common.enums.OrgAnnualReportFields;
  75. import com.goafanti.common.enums.OrgCognizanceFields;
  76. import com.goafanti.common.enums.OrgCognizanceStatus;
  77. import com.goafanti.common.enums.OrgFinanceFields;
  78. import com.goafanti.common.enums.OrgHonorDatumFields;
  79. import com.goafanti.common.enums.OrgHumanResourceFields;
  80. import com.goafanti.common.enums.OrgIntellectualPropertyFields;
  81. import com.goafanti.common.enums.OrgRatepayFields;
  82. import com.goafanti.common.enums.OrgStandardFields;
  83. import com.goafanti.common.enums.OrgTechAchievementFields;
  84. import com.goafanti.common.enums.OrgTechCenterDetailFields;
  85. import com.goafanti.common.enums.OrgTechCenterFields;
  86. import com.goafanti.common.enums.OrgTechProductFields;
  87. import com.goafanti.common.enums.OrganizationIdentityFields;
  88. import com.goafanti.common.enums.ProportionStatus;
  89. import com.goafanti.common.enums.ProprotionFields;
  90. import com.goafanti.common.enums.UserAbilityFields;
  91. import com.goafanti.common.enums.UserFields;
  92. import com.goafanti.common.enums.UserIdentityFields;
  93. import com.goafanti.common.model.Admin;
  94. import com.goafanti.common.model.OrgActivity;
  95. import com.goafanti.common.model.OrgActivityCost;
  96. import com.goafanti.common.model.OrgAnnualReport;
  97. import com.goafanti.common.model.OrgCognizance;
  98. import com.goafanti.common.model.OrgCognizanceLog;
  99. import com.goafanti.common.model.OrgCognizanceProportion;
  100. import com.goafanti.common.model.OrgFinance;
  101. import com.goafanti.common.model.OrgHonorDatum;
  102. import com.goafanti.common.model.OrgHumanResource;
  103. import com.goafanti.common.model.OrgIntellectualProperty;
  104. import com.goafanti.common.model.OrgRatepay;
  105. import com.goafanti.common.model.OrgStandard;
  106. import com.goafanti.common.model.OrgTechAchievement;
  107. import com.goafanti.common.model.OrgTechCenter;
  108. import com.goafanti.common.model.OrgTechCenterDetail;
  109. import com.goafanti.common.model.OrgTechProduct;
  110. import com.goafanti.common.model.OrganizationIdentity;
  111. import com.goafanti.common.model.PatentInfo;
  112. import com.goafanti.common.model.User;
  113. import com.goafanti.common.model.UserAbility;
  114. import com.goafanti.common.model.UserIdentity;
  115. import com.goafanti.common.utils.DateUtils;
  116. import com.goafanti.common.utils.PasswordUtil;
  117. import com.goafanti.common.utils.StringUtils;
  118. import com.goafanti.common.utils.TimeUtils;
  119. import com.goafanti.copyright.bo.CopyrightInfoDetail;
  120. import com.goafanti.copyright.service.CopyrightInfoService;
  121. import com.goafanti.core.mybatis.page.Pagination;
  122. import com.goafanti.core.shiro.token.TokenManager;
  123. import com.goafanti.patent.service.PatentInfoService;
  124. import com.goafanti.user.bo.InputOrganizationIdentity;
  125. import com.goafanti.user.bo.InputUser;
  126. import com.goafanti.user.bo.InputUserAbility;
  127. import com.goafanti.user.bo.InputUserIdentity;
  128. import com.goafanti.user.bo.OrgListBo;
  129. import com.goafanti.user.bo.OrgUnitNames;
  130. import com.goafanti.user.bo.UserListBo;
  131. import com.goafanti.user.service.OrgHumanResourceService;
  132. import com.goafanti.user.service.OrganizationIdentityService;
  133. import com.goafanti.user.service.UserAbilityService;
  134. import com.goafanti.user.service.UserIdentityService;
  135. import com.goafanti.user.service.UserService;
  136. @Controller
  137. @RequestMapping(value = "/api/admin")
  138. public class AdminApiController extends CertifyApiController {
  139. @Resource
  140. private UserService userService;
  141. @Resource
  142. private UserIdentityService userIdentityService;
  143. @Resource
  144. private OrganizationIdentityService organizationIdentityService;
  145. @Resource
  146. private OrgHumanResourceService orgHumanResourceService;
  147. @Resource
  148. private OrgStandardService orgStandardService;
  149. @Resource
  150. private OrgIntellectualPropertyService orgIntellectualPropertyService;
  151. @Resource
  152. private OrgTechProductService orgTechProductService;
  153. @Resource
  154. private OrgRatepayService orgRatepayService;
  155. @Resource
  156. private OrgFinanceService orgFinanceService;
  157. @Resource
  158. private OrgActivityService orgActivityService;
  159. @Resource
  160. private OrgActivityCostService orgActivityCostService;
  161. @Resource
  162. private OrgTechAchievementService orgTechAchievementService;
  163. @Resource
  164. private OrgHonorDatumService orgHonorDatumService;
  165. @Resource
  166. private OrgTechCenterService orgTechCenterService;
  167. @Resource
  168. private OrgCognizanceService orgCognizanceService;
  169. @Resource
  170. private OrgCognizanceLogService orgCognizanceLogService;
  171. @Resource
  172. private UserAbilityService userAbilityService;
  173. @Resource
  174. private OrgAnnualReportService orgAnnualReportService;
  175. @Resource(name = "passwordUtil")
  176. private PasswordUtil passwordUtil;
  177. @Resource
  178. private AdminService adminService;
  179. @Resource
  180. private OrgTechCenterDetailService orgTechCenterDetailService;
  181. @Resource
  182. private PatentInfoService patentInfoService;
  183. @Resource
  184. private CopyrightInfoService copyrightInfoService;
  185. @Resource
  186. private OrgCognizanceProportionService orgCognizanceProportionService;
  187. /**
  188. * 更改资料填写完成状态
  189. *
  190. * @param id
  191. * @return
  192. */
  193. @RequestMapping(value = "/confirmProportion", method = RequestMethod.POST)
  194. public Result confirmProportion(String id, String uid, String sign, Integer status) {
  195. Result res = new Result();
  196. if (StringUtils.isBlank(uid)) {
  197. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户ID"));
  198. return res;
  199. }
  200. if (StringUtils.isBlank(sign)) {
  201. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到类别标记", "类别标记"));
  202. return res;
  203. }
  204. if (null == status) {
  205. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到资料完成状态", "资料完成状态"));
  206. return res;
  207. }
  208. if (ProportionStatus.FINISHED.getCode() != status && ProportionStatus.UNFINISHED.getCode() != status) {
  209. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "资料完成状态"));
  210. return res;
  211. }
  212. if (StringUtils.isBlank(id)) {
  213. OrgCognizanceProportion cp = new OrgCognizanceProportion();
  214. cp.setId(UUID.randomUUID().toString());
  215. cp.setUid(uid);
  216. res.setData(orgCognizanceProportionService.insert(disposeProportionStatus(sign, status, cp)));
  217. return res;
  218. }
  219. OrgCognizanceProportion ocp = orgCognizanceProportionService.selectByPrimaryKey(id);
  220. if (null == ocp) {
  221. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "比重ID"));
  222. return res;
  223. }
  224. res.setData(
  225. orgCognizanceProportionService.updateByPrimaryKeySelective(disposeProportionStatus(sign, status, ocp)));
  226. return res;
  227. }
  228. /**
  229. * 高企培育资料完成情况(比重)
  230. *
  231. * @param uid
  232. * @return
  233. */
  234. @RequestMapping(value = "/proportion", method = RequestMethod.GET)
  235. public Result proportion(String uid) {
  236. Result res = new Result();
  237. if (StringUtils.isBlank(uid)) {
  238. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
  239. return res;
  240. }
  241. res.setData(orgCognizanceProportionService.selectByUid(uid));
  242. return res;
  243. }
  244. /**
  245. * 管理员角色
  246. */
  247. @RequestMapping(value = "/role", method = RequestMethod.GET)
  248. public Result getRole(String uid) {
  249. Result res = new Result();
  250. if (StringUtils.isBlank(uid)) {
  251. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "管理员ID"));
  252. return res;
  253. }
  254. res.setData(adminService.selectRoleByPrimaryKey(uid));
  255. return res;
  256. }
  257. /**
  258. * 管理员"我的客户"列表
  259. *
  260. * @return
  261. */
  262. @RequestMapping(value = "/customer", method = RequestMethod.GET)
  263. public Result getCustomer() {
  264. Result res = new Result();
  265. res.setData(userService.selectUserByAid(TokenManager.getAdminId()));
  266. return res;
  267. }
  268. /**
  269. * 管理员本人信息详情
  270. *
  271. * @param id
  272. * @return
  273. */
  274. @RequestMapping(value = "/adminInfo", method = RequestMethod.GET)
  275. public Result adminInfo() {
  276. Result res = new Result();
  277. if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  278. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "超级管理员"));
  279. return res;
  280. }
  281. res.setData(adminService.selectByPrimaryKey(TokenManager.getAdminId()));
  282. return res;
  283. }
  284. /**
  285. * 管理员修改本人信息
  286. *
  287. * @param admin
  288. * @param bindingResult
  289. * @return
  290. */
  291. @RequestMapping(value = "/updateAdminInfo", method = RequestMethod.POST)
  292. public Result updateAdminInfo(@Valid InputAdmin admin, String pwd, BindingResult bindingResult) {
  293. Result res = new Result();
  294. if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  295. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "超级管理员"));
  296. return res;
  297. }
  298. if (bindingResult.hasErrors()) {
  299. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  300. AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
  301. return res;
  302. }
  303. if (StringUtils.isBlank(admin.getId())) {
  304. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  305. return res;
  306. }
  307. if (StringUtils.isBlank(admin.getMobile())) {
  308. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
  309. return res;
  310. }
  311. if (StringUtils.isBlank(admin.getName())) {
  312. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
  313. return res;
  314. }
  315. Admin a = adminService.selectByMobile(admin.getMobile().trim());
  316. if (!TokenManager.getAdminId().equals(a.getId())) {
  317. res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
  318. return res;
  319. }
  320. Admin ad = new Admin();
  321. BeanUtils.copyProperties(admin, ad);
  322. Admin aa = adminService.selectByPrimaryKey(TokenManager.getAdminId());
  323. ad.setMobile(ad.getMobile().trim());
  324. ad.setCreateTime(aa.getCreateTime());
  325. if (!StringUtils.isBlank(ad.getPassword())) {
  326. if (StringUtils.isBlank(pwd)) {
  327. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "原密码"));
  328. return res;
  329. }
  330. if (!aa.getPassword().equals(passwordUtil.getEncryptPwd(pwd, aa.getCreateTime()))) {
  331. res.getError().add(buildError(ErrorConstants.PWD_NOT_MATCH_ERROR, "", "原密码"));
  332. return res;
  333. }
  334. } else {
  335. ad.setPassword(aa.getPassword());
  336. }
  337. ad.setPassword(passwordUtil.getEncryptPwd(ad));
  338. res.setData(adminService.updateByPrimaryKey(ad));
  339. return res;
  340. }
  341. /**
  342. * 管理员列表
  343. *
  344. * @param province
  345. * @param number
  346. * @param mobile
  347. * @param name
  348. * @param pageNo
  349. * @param pageSize
  350. * @return
  351. */
  352. @RequestMapping(value = "/adminList", method = RequestMethod.GET)
  353. public Result adminList(String province, Integer number, String mobile, String name, String pageNo,
  354. String pageSize) {
  355. Result res = new Result();
  356. Integer pNo = 1;
  357. Integer pSize = 10;
  358. if (StringUtils.isNumeric(pageSize)) {
  359. pSize = Integer.parseInt(pageSize);
  360. }
  361. if (StringUtils.isNumeric(pageNo)) {
  362. pNo = Integer.parseInt(pageNo);
  363. }
  364. res.setData(adminService.listAdmin(province, number, mobile, name, pNo, pSize));
  365. return res;
  366. }
  367. /**
  368. * 新增管理员
  369. *
  370. * @param admin
  371. * @param bindingResult
  372. * @return
  373. */
  374. @RequestMapping(value = "/insertAdmin", method = RequestMethod.POST)
  375. public Result insertAdmin(@Valid InputAdmin admin, BindingResult bindingResult) {
  376. Result res = new Result();
  377. if (bindingResult.hasErrors()) {
  378. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  379. AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
  380. return res;
  381. }
  382. if (StringUtils.isBlank(admin.getMobile())) {
  383. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
  384. return res;
  385. }
  386. if (StringUtils.isBlank(admin.getName())) {
  387. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
  388. return res;
  389. }
  390. Admin a = adminService.selectByMobile(admin.getMobile().trim());
  391. if (null != a) {
  392. res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
  393. return res;
  394. }
  395. Calendar now = Calendar.getInstance();
  396. now.set(Calendar.MILLISECOND, 0);
  397. Admin ad = new Admin();
  398. BeanUtils.copyProperties(admin, ad);
  399. ad.setId(UUID.randomUUID().toString());
  400. ad.setCreateTime(now.getTime());
  401. if (StringUtils.isBlank(ad.getPassword())) {
  402. ad.setPassword("123456");
  403. }
  404. ad.setPassword(passwordUtil.getEncryptPwd(ad));
  405. adminService.insert(ad);
  406. return res;
  407. }
  408. /**
  409. * 管理员详情
  410. *
  411. * @param id
  412. * @return
  413. */
  414. @RequestMapping(value = "/adminDetail", method = RequestMethod.GET)
  415. public Result adminDetail(String id) {
  416. Result res = new Result();
  417. if (StringUtils.isBlank(id)) {
  418. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  419. return res;
  420. }
  421. AdminDetail ad = adminService.selectAdminDetail(id);
  422. res.setData(ad);
  423. return res;
  424. }
  425. /**
  426. * 修改管理员信息
  427. *
  428. * @param admin
  429. * @param bindingResult
  430. * @return
  431. */
  432. @RequestMapping(value = "/updateAdmin", method = RequestMethod.POST)
  433. public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds,
  434. @Valid InputAdmin admin, BindingResult bindingResult) {
  435. Result res = new Result();
  436. if (bindingResult.hasErrors()) {
  437. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  438. AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
  439. return res;
  440. }
  441. if (null == admin.getId()) {
  442. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  443. return res;
  444. }
  445. if (null == admin.getMobile()) {
  446. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
  447. return res;
  448. }
  449. if (null == admin.getName()) {
  450. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
  451. return res;
  452. }
  453. Admin aa = adminService.selectByMobile(admin.getMobile().trim());
  454. if (null != aa && !admin.getId().equals(aa.getId())) {
  455. res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
  456. return res;
  457. }
  458. Admin a = adminService.selectByPrimaryKey(admin.getId());
  459. if (null == a) {
  460. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  461. return res;
  462. }
  463. Admin ad = new Admin();
  464. BeanUtils.copyProperties(admin, ad);
  465. List<String> roles = new ArrayList<String>();
  466. if (roleIds != null && roleIds.length > 0) {
  467. for (String role : roleIds) {
  468. roles.add(role);
  469. }
  470. }
  471. res.setData(adminService.updateByPrimaryKeySelective(ad, roles));
  472. return res;
  473. }
  474. /**
  475. * 重置管理员密码
  476. *
  477. * @param id
  478. * @return
  479. */
  480. @RequestMapping(value = "/resetPwd", method = RequestMethod.POST)
  481. public Result resetPwd(String id) {
  482. Result res = new Result();
  483. if (StringUtils.isBlank(id)) {
  484. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  485. return res;
  486. }
  487. Admin admin = adminService.selectByPrimaryKey(id);
  488. if (null == admin) {
  489. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
  490. return res;
  491. }
  492. Admin a = new Admin();
  493. a.setId(admin.getId());
  494. a.setCreateTime(admin.getCreateTime());
  495. a.setPassword("123456");
  496. a.setPassword(passwordUtil.getEncryptPwd(a));
  497. res.setData(adminService.updateByPrimaryKey(a));
  498. return res;
  499. }
  500. /**
  501. * 新增用户
  502. *
  503. * @param mobile
  504. * @param type
  505. * @param unitName
  506. * @return
  507. */
  508. @RequestMapping(value = "/addNewUser", method = RequestMethod.POST)
  509. public Result addNewUser(@Valid InputUser inputUser, BindingResult bindingResult) {
  510. Result res = new Result();
  511. if (bindingResult.hasErrors()) {
  512. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  513. UserFields.getFieldDesc(bindingResult.getFieldError().getField())));
  514. return res;
  515. }
  516. if (StringUtils.isBlank(inputUser.getMobile())) {
  517. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "mobile", "mobile"));
  518. return res;
  519. }
  520. if (null == inputUser.getType()) {
  521. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "type", "type"));
  522. return res;
  523. }
  524. User user = userService.selectByMobieAndType(inputUser.getMobile().trim(), inputUser.getType());
  525. if (null != user) {
  526. res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
  527. return res;
  528. }
  529. User u = new User();
  530. u.setId(UUID.randomUUID().toString());
  531. u.setMobile(inputUser.getMobile().trim());
  532. u.setPassword(inputUser.getMobile().trim());
  533. u.setType(inputUser.getType());
  534. Calendar now = Calendar.getInstance();
  535. now.set(Calendar.MILLISECOND, 0);
  536. u.setCreateTime(now.getTime());
  537. u.setPassword(passwordUtil.getEncryptPwd(u));
  538. u.setLvl(0);
  539. u.setAid(TokenManager.getAdminId());
  540. userService.insertRegister(u, "", inputUser.getUnitName());
  541. return res;
  542. }
  543. /**
  544. * 个人用户列表
  545. *
  546. * @param mobile
  547. * @param email
  548. * @param createTime
  549. * @param number
  550. * @param auditStatus
  551. * @param pageNo
  552. * @param pageSize
  553. * @return
  554. * @throws ParseException
  555. */
  556. @RequestMapping(value = "/userList", method = RequestMethod.POST)
  557. public Result userList(String mobile, String email,
  558. @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
  559. String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
  560. Result res = new Result();
  561. Integer pNo = 1;
  562. Integer pSize = 10;
  563. if (StringUtils.isNumeric(pageSize)) {
  564. pSize = Integer.parseInt(pageSize);
  565. }
  566. if (StringUtils.isNumeric(pageNo)) {
  567. pNo = Integer.parseInt(pageNo);
  568. }
  569. res.setData(getUserList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
  570. return res;
  571. }
  572. /**
  573. * 个人用户信息明细
  574. *
  575. * @param uid
  576. * @return
  577. */
  578. @RequestMapping(value = "/userDetail", method = RequestMethod.POST)
  579. public Result userDetail(String uid) {
  580. Result res = new Result();
  581. if (StringUtils.isBlank(uid)) {
  582. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  583. return res;
  584. }
  585. res.setData(userIdentityService.selectUserIdentityByUserId(uid));
  586. return res;
  587. }
  588. /**
  589. * 修改个人用户信息
  590. *
  591. * @return
  592. * @throws ParseException
  593. */
  594. @RequestMapping(value = "/updateUserDetail", method = RequestMethod.POST)
  595. public Result updateUserDetail(@Valid InputUserIdentity userIdentity, BindingResult bindingResult,
  596. String paymentDateFormattedDate) {
  597. Result res = new Result();
  598. if (bindingResult.hasErrors()) {
  599. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  600. UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  601. return res;
  602. }
  603. if (null == userIdentity.getUid()) {
  604. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  605. return res;
  606. }
  607. if (!StringUtils.isBlank(paymentDateFormattedDate)) {
  608. try {
  609. userIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, AFTConstants.YYYYMMDD));
  610. } catch (ParseException e) {
  611. }
  612. }
  613. UserIdentity ui = new UserIdentity();
  614. BeanUtils.copyProperties(userIdentity, ui);
  615. if (StringUtils.isBlank(ui.getId())) {
  616. ui.setId(UUID.randomUUID().toString());
  617. ui.setAuditStatus(null == ui.getAuditStatus() ? 0 : ui.getAuditStatus());
  618. if (IdentityAuditStatus.UNCOMMITTED.getCode() == ui.getAuditStatus()) {
  619. ui.setProcess(IdentityProcess.UNCOMMITTED.getCode());
  620. } else if (IdentityAuditStatus.COMMITTED.getCode() == ui.getAuditStatus()
  621. || IdentityAuditStatus.UNPAID.getCode() == ui.getAuditStatus()) {
  622. ui.setProcess(IdentityProcess.COMMITTED.getCode());
  623. } else if (IdentityAuditStatus.PAID.getCode() == ui.getAuditStatus()) {
  624. ui.setProcess(IdentityProcess.FILLIN.getCode());
  625. } else if (IdentityAuditStatus.NOTPASSED.getCode() == ui.getAuditStatus()
  626. || IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()) {
  627. ui.setProcess(IdentityProcess.RESULTS.getCode());
  628. }
  629. res.setData(userIdentityService.insert(ui));
  630. } else {
  631. ui.setAuditStatus(null == ui.getAuditStatus() ? 0 : ui.getAuditStatus());
  632. if (IdentityAuditStatus.UNCOMMITTED.getCode() == ui.getAuditStatus()) {
  633. ui.setProcess(IdentityProcess.UNCOMMITTED.getCode());
  634. } else if (IdentityAuditStatus.COMMITTED.getCode() == ui.getAuditStatus()
  635. || IdentityAuditStatus.UNPAID.getCode() == ui.getAuditStatus()) {
  636. ui.setProcess(IdentityProcess.COMMITTED.getCode());
  637. } else if (IdentityAuditStatus.PAID.getCode() == ui.getAuditStatus()) {
  638. ui.setProcess(IdentityProcess.FILLIN.getCode());
  639. } else if (IdentityAuditStatus.NOTPASSED.getCode() == ui.getAuditStatus()
  640. || IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()) {
  641. ui.setProcess(IdentityProcess.RESULTS.getCode());
  642. }
  643. res.setData(userIdentityService.updateUserDetail(ui));
  644. }
  645. return res;
  646. }
  647. /**
  648. * 团体用户列表
  649. *
  650. * @param mobile
  651. * @param email
  652. * @param createTime
  653. * @param number
  654. * @param auditStatus
  655. * @param pageNo
  656. * @param pageSize
  657. * @return
  658. * @throws ParseException
  659. */
  660. @RequestMapping(value = "/orgList", method = RequestMethod.POST)
  661. public Result orgList(String uid, String mobile, String email,
  662. @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number, String unitName,
  663. Integer auditStatus, String pageNo, String pageSize) throws ParseException {
  664. Result res = new Result();
  665. Integer pNo = 1;
  666. Integer pSize = 10;
  667. if (StringUtils.isNumeric(pageSize)) {
  668. pSize = Integer.parseInt(pageSize);
  669. }
  670. if (StringUtils.isNumeric(pageNo)) {
  671. pNo = Integer.parseInt(pageNo);
  672. }
  673. res.setData(getOrgList(uid, mobile, email, createTime, number, unitName, auditStatus, pNo, pSize));
  674. return res;
  675. }
  676. /**
  677. * 团体用户明细
  678. *
  679. * @param uid
  680. * @return
  681. */
  682. @RequestMapping(value = "/orgDetail", method = RequestMethod.POST)
  683. public Result orgDetail(String uid) {
  684. Result res = new Result();
  685. if (StringUtils.isBlank(uid)) {
  686. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  687. return res;
  688. }
  689. res.setData(organizationIdentityService.selectOrgIdentityByUserId(uid));
  690. return res;
  691. }
  692. /**
  693. * 修改团体用户信息
  694. *
  695. * @param orgIdentity
  696. * @return
  697. * @throws ParseException
  698. */
  699. @RequestMapping(value = "/updateOrgDetail", method = RequestMethod.POST)
  700. public Result updateOrgDetail(@Valid InputOrganizationIdentity orgIdentity, BindingResult bindingResult,
  701. String paymentDateFormattedDate) {
  702. Result res = new Result();
  703. if (bindingResult.hasErrors()) {
  704. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  705. OrganizationIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  706. return res;
  707. }
  708. if (null == orgIdentity.getUid()) {
  709. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  710. return res;
  711. }
  712. if (!StringUtils.isBlank(paymentDateFormattedDate)) {
  713. try {
  714. orgIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, AFTConstants.YYYYMMDD));
  715. } catch (ParseException e) {
  716. }
  717. }
  718. OrganizationIdentity oi = new OrganizationIdentity();
  719. BeanUtils.copyProperties(orgIdentity, oi);
  720. if (StringUtils.isBlank(oi.getId())) {
  721. oi.setId(UUID.randomUUID().toString());
  722. oi.setIdentityType(null == oi.getIdentityType() ? 0 : oi.getIdentityType());
  723. oi.setAuditStatus(null == oi.getAuditStatus() ? 0 : oi.getAuditStatus());
  724. if (IdentityAuditStatus.UNCOMMITTED.getCode() == oi.getAuditStatus()) {
  725. oi.setProcess(IdentityProcess.UNCOMMITTED.getCode());
  726. } else if (IdentityAuditStatus.COMMITTED.getCode() == oi.getAuditStatus()
  727. || IdentityAuditStatus.UNPAID.getCode() == oi.getAuditStatus()) {
  728. oi.setProcess(IdentityProcess.COMMITTED.getCode());
  729. } else if (IdentityAuditStatus.PAID.getCode() == oi.getAuditStatus()) {
  730. oi.setProcess(IdentityProcess.FILLIN.getCode());
  731. } else if (IdentityAuditStatus.NOTPASSED.getCode() == oi.getAuditStatus()
  732. || IdentityAuditStatus.PASSED.getCode() == oi.getAuditStatus()) {
  733. oi.setProcess(IdentityProcess.RESULTS.getCode());
  734. }
  735. oi.setListed(null == oi.getListed() ? 0 : oi.getListed());
  736. oi.setListedType(null == oi.getListedType() ? 0 : oi.getListedType());
  737. res.setData(organizationIdentityService.insert(oi));
  738. } else {
  739. oi.setAuditStatus(null == oi.getAuditStatus() ? 0 : oi.getAuditStatus());
  740. if (IdentityAuditStatus.UNCOMMITTED.getCode() == oi.getAuditStatus()) {
  741. oi.setProcess(IdentityProcess.UNCOMMITTED.getCode());
  742. } else if (IdentityAuditStatus.COMMITTED.getCode() == oi.getAuditStatus()
  743. || IdentityAuditStatus.UNPAID.getCode() == oi.getAuditStatus()) {
  744. oi.setProcess(IdentityProcess.COMMITTED.getCode());
  745. } else if (IdentityAuditStatus.PAID.getCode() == oi.getAuditStatus()) {
  746. oi.setProcess(IdentityProcess.FILLIN.getCode());
  747. } else if (IdentityAuditStatus.NOTPASSED.getCode() == oi.getAuditStatus()
  748. || IdentityAuditStatus.PASSED.getCode() == oi.getAuditStatus()) {
  749. oi.setProcess(IdentityProcess.RESULTS.getCode());
  750. }
  751. res.setData(organizationIdentityService.updateOrgDetail(oi));
  752. }
  753. return res;
  754. }
  755. /**
  756. * 团体用户人力资源情况列表
  757. *
  758. * @param uid
  759. * 用户ID
  760. * @return
  761. */
  762. @RequestMapping(value = "/orgHumanResource", method = RequestMethod.POST)
  763. public Result orgHumanResource(Integer year, String pageNo, String pageSize, String uid) {
  764. Result res = new Result();
  765. if (StringUtils.isBlank(uid)) {
  766. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  767. return res;
  768. }
  769. if (!checkCertify(res, uid).getError().isEmpty()) {
  770. return res;
  771. }
  772. Integer pNo = 1;
  773. Integer pSize = 10;
  774. if (StringUtils.isNumeric(pageSize)) {
  775. pSize = Integer.parseInt(pageSize);
  776. }
  777. if (StringUtils.isNumeric(pageNo)) {
  778. pNo = Integer.parseInt(pageNo);
  779. }
  780. res.setData(orgHumanResourceService.listOrgHumanResource(year, pNo, pSize, uid));
  781. return res;
  782. }
  783. /**
  784. * 新增及修改团体用户人力资源情况
  785. *
  786. * @param orgHumanResource
  787. * @return
  788. */
  789. @RequestMapping(value = "/updateOrgHumanResource", method = RequestMethod.POST)
  790. public Result updateOrgHumanResource(@Valid InputOrgHumanResource orgHumanResource, BindingResult bindingResult) {
  791. Result res = new Result();
  792. if (bindingResult.hasErrors()) {
  793. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  794. OrgHumanResourceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  795. return res;
  796. }
  797. if (StringUtils.isBlank(orgHumanResource.getUid())) {
  798. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  799. return res;
  800. }
  801. if (null == orgHumanResource.getYear()) {
  802. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  803. return res;
  804. }
  805. if (!checkCertify(res, orgHumanResource.getUid()).getError().isEmpty()) {
  806. return res;
  807. }
  808. OrgHumanResource ohr = new OrgHumanResource();
  809. BeanUtils.copyProperties(orgHumanResource, ohr);
  810. if (StringUtils.isBlank(ohr.getId())) {
  811. if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(ohr.getYear(), ohr.getUid())) {
  812. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
  813. return res;
  814. }
  815. ohr.setId(UUID.randomUUID().toString());
  816. ohr.setDeletedSign(DeleteStatus.UNDELETE.getCode());
  817. orgHumanResourceService.insert(ohr);
  818. } else {
  819. orgHumanResourceService.updateByPrimaryKeySelective(ohr);
  820. }
  821. return res;
  822. }
  823. /**
  824. * 企业花名册上传
  825. *
  826. * @param req
  827. * @param sign
  828. * @param uid
  829. * @return
  830. */
  831. @RequestMapping(value = "/uploadRoster", method = RequestMethod.POST)
  832. public Result uploadRoster(HttpServletRequest req, String sign, String uid, String year) {
  833. Result res = new Result();
  834. if (StringUtils.isBlank(year)) {
  835. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  836. return res;
  837. }
  838. User curUser = userService.selectByPrimaryKey(uid);
  839. if (!checkCertify(res, curUser)) {
  840. return res;
  841. }
  842. AttachmentType attachmentType = AttachmentType.getField(sign);
  843. if (attachmentType == AttachmentType.ROSTER) {
  844. sign = sign + "_" + year;
  845. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  846. } else {
  847. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  848. }
  849. return res;
  850. }
  851. /**
  852. * 企业社保情况表上传
  853. *
  854. * @param req
  855. * @param sign
  856. * @param uid
  857. * @return
  858. */
  859. @RequestMapping(value = "/uploadSocialSecurity", method = RequestMethod.POST)
  860. public Result uploadSocialSecurity(HttpServletRequest req, String sign, String uid, String year) {
  861. Result res = new Result();
  862. if (StringUtils.isBlank(year)) {
  863. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  864. return res;
  865. }
  866. User curUser = userService.selectByPrimaryKey(uid);
  867. if (!checkCertify(res, curUser)) {
  868. return res;
  869. }
  870. AttachmentType attachmentType = AttachmentType.getField(sign);
  871. if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
  872. sign = sign + "_" + year;
  873. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  874. } else {
  875. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  876. }
  877. return res;
  878. }
  879. /**
  880. * 企业花名册及社保情况表下载
  881. *
  882. * @param response
  883. * @param sign
  884. * @param id
  885. * @return
  886. */
  887. @RequestMapping(value = "/downloadHumanResource", method = RequestMethod.GET)
  888. public Result downloadHumanResource(HttpServletResponse response, String sign, String id) {
  889. Result res = new Result();
  890. if (StringUtils.isEmpty(id)) {
  891. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
  892. return res;
  893. }
  894. OrgHumanResource ohr = orgHumanResourceService.selectByPrimaryKey(id);
  895. if (ohr == null) {
  896. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
  897. return res;
  898. }
  899. AttachmentType attachmentType = AttachmentType.getField(sign);
  900. if (attachmentType == AttachmentType.ROSTER) {
  901. downloadFile(response, ohr.getRosterDownloadFileName(), ohr.getRosterUrl());
  902. } else if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
  903. downloadFile(response, ohr.getSocialSecurityDownloadFileName(), ohr.getSocialSecurityUrl());
  904. } else {
  905. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  906. }
  907. return res;
  908. }
  909. /**
  910. * 企业参与国家标准或行业标准制定情况明细列表
  911. *
  912. * @param uid
  913. * 用户id
  914. * @return
  915. */
  916. @RequestMapping(value = "/standard", method = RequestMethod.POST)
  917. public Result standard(String uid, String standardName, String standardNumber, Integer standardLevel,
  918. Integer participateWay, String pageNo, String pageSize) {
  919. Result res = new Result();
  920. if (StringUtils.isBlank(uid)) {
  921. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  922. return res;
  923. }
  924. if (!checkCertify(res, uid).getError().isEmpty()) {
  925. return res;
  926. }
  927. Integer pNo = 1;
  928. Integer pSize = 10;
  929. if (StringUtils.isNumeric(pageSize)) {
  930. pSize = Integer.parseInt(pageSize);
  931. }
  932. if (StringUtils.isNumeric(pageNo)) {
  933. pNo = Integer.parseInt(pageNo);
  934. }
  935. res.setData(orgStandardService.listOrgStandard(standardName, standardNumber, standardLevel, participateWay, pNo,
  936. pSize, uid));
  937. return res;
  938. }
  939. /**
  940. * 企业参与国家标准或行业标准制定情况明细新增及修改
  941. *
  942. * @param orgStandard
  943. * @return
  944. */
  945. @RequestMapping(value = "/developStandard", method = RequestMethod.POST)
  946. public Result developStandard(@Valid InputOrgStandard orgStandard, BindingResult bindingResult) {
  947. Result res = new Result();
  948. if (bindingResult.hasErrors()) {
  949. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  950. OrgStandardFields.getFieldDesc(bindingResult.getFieldError().getField())));
  951. return res;
  952. }
  953. if (StringUtils.isBlank(orgStandard.getUid())) {
  954. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  955. return res;
  956. }
  957. if (null == orgStandard.getYear()) {
  958. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  959. return res;
  960. }
  961. if (!checkCertify(res, orgStandard.getUid()).getError().isEmpty()) {
  962. return res;
  963. }
  964. OrgStandard os = new OrgStandard();
  965. BeanUtils.copyProperties(orgStandard, os);
  966. if (StringUtils.isBlank(os.getId())) {
  967. os.setId(UUID.randomUUID().toString());
  968. os.setDeletedSign(0);
  969. Calendar now = Calendar.getInstance();
  970. now.set(Calendar.MILLISECOND, 0);
  971. os.setCreateTime(now.getTime());
  972. orgStandardService.insert(os);
  973. } else {
  974. orgStandardService.updateByPrimaryKeySelective(os);
  975. }
  976. res.setData(orgStandard);
  977. return res;
  978. }
  979. /**
  980. * 上传标准制定附件
  981. *
  982. * @param req
  983. * @param sign
  984. * @param uid
  985. * @param year
  986. * @return
  987. */
  988. @RequestMapping(value = "/uploadStandard", method = RequestMethod.POST)
  989. public Result uploadStandard(HttpServletRequest req, String sign, String uid) {
  990. Result res = new Result();
  991. User curUser = userService.selectByPrimaryKey(uid);
  992. if (!checkCertify(res, curUser)) {
  993. return res;
  994. }
  995. AttachmentType attachmentType = AttachmentType.getField(sign);
  996. if (attachmentType == AttachmentType.STANDARD) {
  997. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  998. } else {
  999. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1000. }
  1001. return res;
  1002. }
  1003. /**
  1004. * 下载标准制定附件
  1005. *
  1006. * @param response
  1007. * @param sign
  1008. * @param id
  1009. * @return
  1010. */
  1011. @RequestMapping(value = "/downloadStandard", method = RequestMethod.GET)
  1012. public Result downloadStandard(HttpServletResponse response, String sign, String id) {
  1013. Result res = new Result();
  1014. if (StringUtils.isEmpty(id)) {
  1015. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准制定id"));
  1016. return res;
  1017. }
  1018. OrgStandard os = orgStandardService.selectByPrimaryKey(id);
  1019. if (os == null) {
  1020. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准指定id"));
  1021. return res;
  1022. }
  1023. AttachmentType attachmentType = AttachmentType.getField(sign);
  1024. if (attachmentType == AttachmentType.STANDARD) {
  1025. downloadFile(response, os.getStandardDownloadFileName(), os.getEnclosureUrl());
  1026. } else {
  1027. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1028. }
  1029. return res;
  1030. }
  1031. /**
  1032. * 删除标准制定情况记录
  1033. *
  1034. * @param id
  1035. * 记录id
  1036. * @return
  1037. */
  1038. @RequestMapping(value = "/deleteStandard", method = RequestMethod.POST)
  1039. public Result deleteStandard(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1040. Result res = new Result();
  1041. if (ids == null || ids.length < 1) {
  1042. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1043. } else {
  1044. res.setData(orgStandardService.deleteByPrimaryKey(Arrays.asList(ids)));
  1045. }
  1046. return res;
  1047. }
  1048. /**
  1049. * 知识产权列表
  1050. *
  1051. * @param pageNo
  1052. * @param pageSize
  1053. * @return
  1054. */
  1055. @RequestMapping(value = "/intellectualList", method = RequestMethod.POST)
  1056. public Result intellectualList(String pageNo, String pageSize, String uid) {
  1057. Result res = new Result();
  1058. if (StringUtils.isBlank(uid)) {
  1059. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1060. return res;
  1061. }
  1062. if (!checkCertify(res, uid).getError().isEmpty()) {
  1063. return res;
  1064. }
  1065. Integer pNo = 1;
  1066. Integer pSize = 10;
  1067. if (StringUtils.isNumeric(pageSize)) {
  1068. pSize = Integer.parseInt(pageSize);
  1069. }
  1070. if (StringUtils.isNumeric(pageNo)) {
  1071. pNo = Integer.parseInt(pageNo);
  1072. }
  1073. res.setData(orgIntellectualPropertyService.listIntellectual(pNo, pSize, uid));
  1074. return res;
  1075. }
  1076. /**
  1077. * 知识产权详情
  1078. *
  1079. * @return
  1080. */
  1081. @RequestMapping(value = "/intellectualDetail", method = RequestMethod.GET)
  1082. public Result intellectualDetail(String id, Integer type) {
  1083. Result res = new Result();
  1084. if (StringUtils.isBlank(id)) {
  1085. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权ID"));
  1086. return res;
  1087. }
  1088. if (null == type) {
  1089. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
  1090. return res;
  1091. }
  1092. OrgIntellectualProperty oip = orgIntellectualPropertyService.selectByPrimaryKey(id);
  1093. if (null == oip) {
  1094. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
  1095. return res;
  1096. }
  1097. if (IntellectualPropertyType.PATENT.getCode() == type) {
  1098. res.setData(orgIntellectualPropertyService.selectPatentTypeDetail(id));
  1099. } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
  1100. res.setData(orgIntellectualPropertyService.selectCopyrightTypeDetail(id));
  1101. } else if (IntellectualPropertyType.COMMON.getCode() == type) {
  1102. OrgIntellectualPropertyDetailBo oipdb = new OrgIntellectualPropertyDetailBo();
  1103. BeanUtils.copyProperties(oip, oipdb);
  1104. res.setData(oipdb);
  1105. } else {
  1106. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
  1107. }
  1108. return res;
  1109. }
  1110. /**
  1111. * 知识产权信息新增及修改
  1112. *
  1113. * @return
  1114. * @throws ParseException
  1115. */
  1116. @RequestMapping(value = "/intellectual", method = RequestMethod.POST)
  1117. public Result intellectual(@Valid InputOrgIntellectualProperty orgIntellectualProperty, BindingResult bindingResult,
  1118. String authorizationDateFormattedDate) {
  1119. Result res = new Result();
  1120. if (bindingResult.hasErrors()) {
  1121. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1122. OrgIntellectualPropertyFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1123. return res;
  1124. }
  1125. if (StringUtils.isBlank(orgIntellectualProperty.getUid())) {
  1126. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1127. return res;
  1128. }
  1129. if (!checkCertify(res, orgIntellectualProperty.getUid()).getError().isEmpty()) {
  1130. return res;
  1131. }
  1132. if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
  1133. try {
  1134. orgIntellectualProperty.setAuthorizationDate(
  1135. DateUtils.parseDate(authorizationDateFormattedDate, AFTConstants.YYYYMMDD));
  1136. } catch (ParseException e) {
  1137. }
  1138. }
  1139. OrgIntellectualProperty oip = new OrgIntellectualProperty();
  1140. BeanUtils.copyProperties(orgIntellectualProperty, oip);
  1141. if (StringUtils.isBlank(oip.getId())) {
  1142. oip.setId(UUID.randomUUID().toString());
  1143. oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 1 : 0);
  1144. oip.setDeletedSign(0);
  1145. oip.setType(IntellectualPropertyType.COMMON.getCode());
  1146. res.setData(orgIntellectualPropertyService.insert(oip));
  1147. } else {
  1148. oip.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
  1149. res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(oip));
  1150. }
  1151. return res;
  1152. }
  1153. /**
  1154. * 知识产权证书上传
  1155. *
  1156. * @param req
  1157. * @param sign
  1158. * @param uid
  1159. * @return
  1160. */
  1161. @RequestMapping(value = "/uploadPropertyRight", method = RequestMethod.POST)
  1162. public Result uploadPropertyRight(HttpServletRequest req, String sign, String uid) {
  1163. Result res = new Result();
  1164. User curUser = userService.selectByPrimaryKey(uid);
  1165. if (!checkCertify(res, curUser)) {
  1166. return res;
  1167. }
  1168. AttachmentType attachmentType = AttachmentType.getField(sign);
  1169. if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
  1170. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  1171. } else {
  1172. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1173. }
  1174. return res;
  1175. }
  1176. /**
  1177. * 知识产权证书下载
  1178. *
  1179. * @param response
  1180. * @param sign
  1181. * @param id
  1182. * @return
  1183. */
  1184. @RequestMapping(value = "/downloadPropertyRight", method = RequestMethod.GET)
  1185. public Result downloadPropertyRight(HttpServletResponse response, String sign, String id) {
  1186. Result res = new Result();
  1187. if (StringUtils.isEmpty(id)) {
  1188. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
  1189. return res;
  1190. }
  1191. OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
  1192. if (olp == null) {
  1193. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
  1194. return res;
  1195. }
  1196. AttachmentType attachmentType = AttachmentType.getField(sign);
  1197. if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
  1198. downloadFile(response, olp.getPropertyRightDownloadFileName(), olp.getPropertyRightUrl());
  1199. } else {
  1200. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1201. }
  1202. return res;
  1203. }
  1204. /**
  1205. * 知识产权稿件下载
  1206. *
  1207. * @param response
  1208. * @param sign
  1209. * @param id
  1210. * @return
  1211. */
  1212. @RequestMapping(value = "/downloadManuscript", method = RequestMethod.GET)
  1213. public Result downloadManuscript(HttpServletResponse response, String sign, String id, Integer type) {
  1214. Result res = new Result();
  1215. if (StringUtils.isEmpty(id)) {
  1216. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权id"));
  1217. return res;
  1218. }
  1219. if (null == type) {
  1220. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
  1221. return res;
  1222. }
  1223. OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
  1224. if (olp == null) {
  1225. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
  1226. return res;
  1227. }
  1228. String fileName = null;
  1229. String downloadUrl = null;
  1230. if (IntellectualPropertyType.PATENT.getCode() == type) {
  1231. PatentInfo pi = patentInfoService.selectByPrimaryKey(olp.getPid());
  1232. if (null == pi) {
  1233. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
  1234. return res;
  1235. }
  1236. fileName = pi.getPatentWritingDownloadFileName();
  1237. downloadUrl = pi.getPatentWritingUrl();
  1238. } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
  1239. CopyrightInfoDetail ci = copyrightInfoService.findByPrimaryKey(olp.getPid());
  1240. if (null == ci) {
  1241. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
  1242. return res;
  1243. }
  1244. fileName = ci.getApplicationUrlDownloadFileName();
  1245. downloadUrl = ci.getApplicationUrl();
  1246. } else {
  1247. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
  1248. return res;
  1249. }
  1250. AttachmentType attachmentType = AttachmentType.getField(sign);
  1251. if (attachmentType == AttachmentType.MANUSCRIPT) {
  1252. downloadFile(response, fileName, downloadUrl);
  1253. } else {
  1254. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1255. }
  1256. return res;
  1257. }
  1258. /**
  1259. * 删除知识产权记录
  1260. *
  1261. * @param id
  1262. * @return
  1263. */
  1264. @RequestMapping(value = "/deleteIntellectual", method = RequestMethod.POST)
  1265. public Result deleteIntellectual(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1266. Result res = new Result();
  1267. if (ids == null || ids.length < 1) {
  1268. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1269. } else {
  1270. res.setData(orgIntellectualPropertyService.deleteByPrimaryKey(Arrays.asList(ids)));
  1271. }
  1272. return res;
  1273. }
  1274. /**
  1275. * 上年度高新技术产品(服务)情况列表
  1276. *
  1277. * @param pageNo
  1278. * @param pageSize
  1279. * @return
  1280. */
  1281. @RequestMapping(value = "/techProductList", method = RequestMethod.POST)
  1282. public Result techProductList(String pageNo, String pageSize, String uid) {
  1283. Result res = new Result();
  1284. if (StringUtils.isBlank(uid)) {
  1285. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1286. return res;
  1287. }
  1288. if (!checkCertify(res, uid).getError().isEmpty()) {
  1289. return res;
  1290. }
  1291. Integer pNo = 1;
  1292. Integer pSize = 10;
  1293. if (StringUtils.isNumeric(pageSize)) {
  1294. pSize = Integer.parseInt(pageSize);
  1295. }
  1296. if (StringUtils.isNumeric(pageNo)) {
  1297. pNo = Integer.parseInt(pageNo);
  1298. }
  1299. res.setData(orgTechProductService.listTechProduct(pNo, pSize, uid));
  1300. return res;
  1301. }
  1302. /**
  1303. * 上年度高新技术产品(服务)情况(新增+修改)
  1304. *
  1305. * @param orgTechProduct
  1306. * @return
  1307. */
  1308. @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
  1309. public Result techProduct(@Valid InputOrgTechProduct orgTechProduct, BindingResult bindingResult) {
  1310. Result res = new Result();
  1311. if (bindingResult.hasErrors()) {
  1312. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1313. OrgTechProductFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1314. return res;
  1315. }
  1316. if (StringUtils.isBlank(orgTechProduct.getUid())) {
  1317. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1318. return res;
  1319. }
  1320. if (!checkCertify(res, orgTechProduct.getUid()).getError().isEmpty()) {
  1321. return res;
  1322. }
  1323. OrgTechProduct otp = new OrgTechProduct();
  1324. BeanUtils.copyProperties(orgTechProduct, otp);
  1325. if (StringUtils.isBlank(otp.getId())) {
  1326. otp.setId(UUID.randomUUID().toString());
  1327. otp.setDeletedSign(0);
  1328. Calendar now = Calendar.getInstance();
  1329. now.set(Calendar.MILLISECOND, 0);
  1330. otp.setCreateTime(now.getTime());
  1331. otp.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
  1332. orgTechProductService.insert(otp);
  1333. } else {
  1334. orgTechProductService.updateByPrimaryKeySelective(otp);
  1335. }
  1336. res.setData(orgTechProduct);
  1337. return res;
  1338. }
  1339. /**
  1340. * 高新技术产品台帐上传
  1341. *
  1342. * @param req
  1343. * @param sign
  1344. * @param uid
  1345. * @return
  1346. */
  1347. @RequestMapping(value = "/uploadTecProduct", method = RequestMethod.POST)
  1348. public Result uploadTecProduct(HttpServletRequest req, String sign, String uid) {
  1349. Result res = new Result();
  1350. User curUser = userService.selectByPrimaryKey(uid);
  1351. if (!checkCertify(res, curUser)) {
  1352. return res;
  1353. }
  1354. AttachmentType attachmentType = AttachmentType.getField(sign);
  1355. if (attachmentType == AttachmentType.TECH_PRODUCT) {
  1356. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  1357. } else {
  1358. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1359. }
  1360. return res;
  1361. }
  1362. /**
  1363. * 高新技术产品台帐下载
  1364. *
  1365. * @param response
  1366. * @param sign
  1367. * @param id
  1368. * @return
  1369. */
  1370. @RequestMapping(value = "/downloadTecProduct", method = RequestMethod.GET)
  1371. public Result downloadTecProduct(HttpServletResponse response, String sign, String id) {
  1372. Result res = new Result();
  1373. if (StringUtils.isEmpty(id)) {
  1374. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
  1375. return res;
  1376. }
  1377. OrgTechProduct otp = orgTechProductService.selectByPrimaryKey(id);
  1378. if (otp == null) {
  1379. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
  1380. return res;
  1381. }
  1382. AttachmentType attachmentType = AttachmentType.getField(sign);
  1383. if (attachmentType == AttachmentType.TECH_PRODUCT) {
  1384. downloadFile(response, otp.getAccountDownloadFileName(), otp.getAccountUrl());
  1385. } else {
  1386. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1387. }
  1388. return res;
  1389. }
  1390. /**
  1391. * 删除上年度高新技术产品(服务)情况记录
  1392. *
  1393. * @param ids
  1394. * @return
  1395. */
  1396. @RequestMapping(value = "/deleteTechProduct", method = RequestMethod.POST)
  1397. public Result deleteTechProduct(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1398. Result res = new Result();
  1399. if (ids == null || ids.length < 1) {
  1400. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1401. } else {
  1402. res.setData(orgTechProductService.deleteByPrimaryKey(Arrays.asList(ids)));
  1403. }
  1404. return res;
  1405. }
  1406. /**
  1407. * 企业研究开发活动情况表入口
  1408. *
  1409. * @param activityNumber
  1410. * @param activityName
  1411. * @param startDate
  1412. * @param endDate
  1413. * @param pageNo
  1414. * @param pageSize
  1415. * @return
  1416. * @throws ParseException
  1417. */
  1418. @RequestMapping(value = "/activityList", method = RequestMethod.POST)
  1419. public Result activityList(String activityNumber, String activityName, String startDateFormattedDate,
  1420. String endDateFormattedDate, String pageNo, String pageSize, String uid) throws ParseException {
  1421. Result res = new Result();
  1422. if (StringUtils.isBlank(uid)) {
  1423. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1424. }
  1425. if (!checkCertify(res, uid).getError().isEmpty()) {
  1426. return res;
  1427. }
  1428. Integer pNo = 1;
  1429. Integer pSize = 10;
  1430. if (StringUtils.isNumeric(pageSize)) {
  1431. pSize = Integer.parseInt(pageSize);
  1432. }
  1433. if (StringUtils.isNumeric(pageNo)) {
  1434. pNo = Integer.parseInt(pageNo);
  1435. }
  1436. res.setData(orgActivityService.listOrgActivity(activityNumber, activityName, startDateFormattedDate,
  1437. endDateFormattedDate, pNo, pSize, uid));
  1438. return res;
  1439. }
  1440. /**
  1441. * 研发活动详情
  1442. *
  1443. * @param id
  1444. * @return
  1445. */
  1446. @RequestMapping(value = "/activityDetail", method = RequestMethod.GET)
  1447. public Result activityDetail(String id) {
  1448. Result res = new Result();
  1449. if (StringUtils.isBlank(id)) {
  1450. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  1451. return res;
  1452. }
  1453. Calendar a = Calendar.getInstance();
  1454. res.setData(orgActivityService.selectDetailByIdAndYear(id, a.get(Calendar.YEAR) - 1));
  1455. return res;
  1456. }
  1457. /**
  1458. * 企业研究开发活动情况新增、修改
  1459. *
  1460. * @param orgActivity
  1461. * @return
  1462. * @throws ParseException
  1463. */
  1464. @RequestMapping(value = "/activity", method = RequestMethod.POST)
  1465. public Result activity(@Valid InputOrgActivity orgActivity, BindingResult bindingResult,
  1466. String startDateFormattedDate, String endDateFormattedDate) {
  1467. Result res = new Result();
  1468. if (bindingResult.hasErrors()) {
  1469. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1470. OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1471. return res;
  1472. }
  1473. if (StringUtils.isBlank(orgActivity.getUid())) {
  1474. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1475. return res;
  1476. }
  1477. if (!checkCertify(res, orgActivity.getUid()).getError().isEmpty()) {
  1478. return res;
  1479. }
  1480. if (!StringUtils.isBlank(startDateFormattedDate)) {
  1481. try {
  1482. orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDD));
  1483. } catch (ParseException e) {
  1484. }
  1485. }
  1486. if (!StringUtils.isBlank(endDateFormattedDate)) {
  1487. try {
  1488. orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD));
  1489. } catch (ParseException e) {
  1490. }
  1491. }
  1492. OrgActivity oa = new OrgActivity();
  1493. BeanUtils.copyProperties(orgActivity, oa);
  1494. oa.setDeletedSign(0);
  1495. if (StringUtils.isBlank(oa.getId())) {
  1496. oa.setId(UUID.randomUUID().toString());
  1497. orgActivityService.insert(oa);
  1498. } else {
  1499. orgActivityService.updateOrgActivity(oa);
  1500. }
  1501. res.setData(orgActivity);
  1502. return res;
  1503. }
  1504. /**
  1505. * 研发活动立项证明材料上传
  1506. *
  1507. * @param req
  1508. * @param sign
  1509. * @param uid
  1510. * @return
  1511. */
  1512. @RequestMapping(value = "/uploadProof", method = RequestMethod.POST)
  1513. public Result uploadProof(HttpServletRequest req, String sign, String uid) {
  1514. Result res = new Result();
  1515. User curUser = userService.selectByPrimaryKey(uid);
  1516. if (!checkCertify(res, curUser)) {
  1517. return res;
  1518. }
  1519. AttachmentType attachmentType = AttachmentType.getField(sign);
  1520. if (attachmentType == AttachmentType.PROOF) {
  1521. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  1522. } else {
  1523. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1524. }
  1525. return res;
  1526. }
  1527. /**
  1528. * 研发活动立项证明材料下载
  1529. *
  1530. * @param response
  1531. * @param sign
  1532. * @param id
  1533. * @return
  1534. */
  1535. @RequestMapping(value = "/downloadProof", method = RequestMethod.GET)
  1536. public Result downloadProof(HttpServletResponse response, String sign, String id) {
  1537. Result res = new Result();
  1538. if (StringUtils.isEmpty(id)) {
  1539. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  1540. return res;
  1541. }
  1542. OrgActivity oa = orgActivityService.selectOrgActivityByPrimaryKey(id);
  1543. if (oa == null) {
  1544. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
  1545. return res;
  1546. }
  1547. AttachmentType attachmentType = AttachmentType.getField(sign);
  1548. if (attachmentType == AttachmentType.PROOF) {
  1549. downloadFile(response, oa.getProofDownloadFileName(), oa.getProofUrl());
  1550. } else {
  1551. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1552. }
  1553. return res;
  1554. }
  1555. /**
  1556. * 删除企业研究开发活动情况
  1557. *
  1558. * @param ids
  1559. * @return
  1560. */
  1561. @RequestMapping(value = "/deleteActivity", method = RequestMethod.POST)
  1562. public Result deleteActivity(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1563. Result res = new Result();
  1564. if (ids == null || ids.length < 1) {
  1565. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1566. } else {
  1567. res.setData(orgActivityService.deleteByPrimaryKey(Arrays.asList(ids)));
  1568. orgActivityCostService.deleteByAid(Arrays.asList(ids));
  1569. }
  1570. return res;
  1571. }
  1572. /**
  1573. * 企业年度研究开发费用结构明细表列表
  1574. *
  1575. * @return
  1576. * @throws ParseException
  1577. */
  1578. @RequestMapping(value = "/activityCostList", method = RequestMethod.POST)
  1579. public Result activityCostList(String activityNumber, String startDateFormattedDate, String endDateFormattedDate,
  1580. String pageNo, String pageSize, String uid, Integer year) throws ParseException {
  1581. Result res = new Result();
  1582. if (StringUtils.isBlank(uid)) {
  1583. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1584. return res;
  1585. }
  1586. if (!checkCertify(res, uid).getError().isEmpty()) {
  1587. return res;
  1588. }
  1589. Integer pNo = 1;
  1590. Integer pSize = 10;
  1591. if (StringUtils.isNumeric(pageSize)) {
  1592. pSize = Integer.parseInt(pageSize);
  1593. }
  1594. if (StringUtils.isNumeric(pageNo)) {
  1595. pNo = Integer.parseInt(pageNo);
  1596. }
  1597. res.setData(orgActivityCostService.listOrgActivityCost(activityNumber, startDateFormattedDate,
  1598. endDateFormattedDate, pNo, pSize, uid, year));
  1599. return res;
  1600. }
  1601. /**
  1602. * 企业年度研究开发费用结构明细表(新增+修改)
  1603. *
  1604. * @return
  1605. * @throws ParseException
  1606. */
  1607. @RequestMapping(value = "/activityCost", method = RequestMethod.POST)
  1608. public Result activityCost(@Valid InputOrgActivityCost orgActivityCost, BindingResult bindingResult,
  1609. String signDateFormattedDate) {
  1610. Result res = new Result();
  1611. if (bindingResult.hasErrors()) {
  1612. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1613. OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1614. return res;
  1615. }
  1616. if (StringUtils.isBlank(orgActivityCost.getUid())) {
  1617. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1618. return res;
  1619. }
  1620. if (StringUtils.isBlank(orgActivityCost.getAid())) {
  1621. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到研发活动", "研发活动ID"));
  1622. return res;
  1623. }
  1624. if (null == orgActivityCost.getYear()) {
  1625. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1626. return res;
  1627. }
  1628. if (!checkCertify(res, orgActivityCost.getUid()).getError().isEmpty()) {
  1629. return res;
  1630. }
  1631. if (StringUtils.isBlank(signDateFormattedDate)) {
  1632. try {
  1633. orgActivityCost.setSignDate(DateUtils.parseDate(signDateFormattedDate, AFTConstants.YYYYMMDD));
  1634. } catch (ParseException e) {
  1635. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业填报人签字日期"));
  1636. return res;
  1637. }
  1638. }
  1639. OrgActivityCost oac = new OrgActivityCost();
  1640. BeanUtils.copyProperties(orgActivityCost, oac);
  1641. if (StringUtils.isBlank(oac.getId())) {
  1642. if (null != orgActivityCostService.selectOrgActivityCostByAidAndYear(oac.getAid(), oac.getYear())) {
  1643. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目当前年份费用详情已录入!"));
  1644. return res;
  1645. }
  1646. OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(oac.getAid());
  1647. if (null != ac) {
  1648. Calendar c = Calendar.getInstance();
  1649. c.setTime(ac.getStartDate());
  1650. Integer s = c.get(Calendar.YEAR);
  1651. c.setTime(ac.getEndDate());
  1652. Integer e = c.get(Calendar.YEAR);
  1653. if (oac.getYear() < s || oac.getYear() > e) {
  1654. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
  1655. return res;
  1656. }
  1657. oac.setStartDate(null == ac.getStartDate() ? null : ac.getStartDate());
  1658. oac.setEndDate(null == ac.getEndDate() ? null : ac.getEndDate());
  1659. oac.setId(UUID.randomUUID().toString());
  1660. oac.setDeletedSign(0);
  1661. orgActivityCostService.insert(oac);
  1662. } else {
  1663. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到研发活动", "研发活动ID"));
  1664. return res;
  1665. }
  1666. } else {
  1667. orgActivityCostService.updateByPrimaryKeySelective(oac);
  1668. }
  1669. return res;
  1670. }
  1671. /**
  1672. * 研发活动费用台帐上传
  1673. *
  1674. * @param req
  1675. * @param sign
  1676. * @param uid
  1677. * @return
  1678. */
  1679. @RequestMapping(value = "/uploadActivityCost", method = RequestMethod.POST)
  1680. public Result uploadActivityCost(HttpServletRequest req, String sign, String uid) {
  1681. Result res = new Result();
  1682. User curUser = userService.selectByPrimaryKey(uid);
  1683. if (!checkCertify(res, curUser)) {
  1684. return res;
  1685. }
  1686. AttachmentType attachmentType = AttachmentType.getField(sign);
  1687. if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
  1688. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  1689. } else {
  1690. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1691. }
  1692. return res;
  1693. }
  1694. /**
  1695. * 研发活动费用台帐下载
  1696. *
  1697. * @param response
  1698. * @param sign
  1699. * @param id
  1700. * @return
  1701. */
  1702. @RequestMapping(value = "/downloadActivityCost", method = RequestMethod.GET)
  1703. public Result downloadActivityCost(HttpServletResponse response, String sign, String id) {
  1704. Result res = new Result();
  1705. if (StringUtils.isEmpty(id)) {
  1706. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
  1707. return res;
  1708. }
  1709. OrgActivityCost oac = orgActivityCostService.selectByPrimaryKey(id);
  1710. if (oac == null) {
  1711. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
  1712. return res;
  1713. }
  1714. AttachmentType attachmentType = AttachmentType.getField(sign);
  1715. if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
  1716. downloadFile(response, oac.getAccountDownloadFileName(), oac.getAccountUrl());
  1717. } else {
  1718. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1719. }
  1720. return res;
  1721. }
  1722. /**
  1723. * 删除企业年度研究开发费用结构明细记录
  1724. *
  1725. * @param ids
  1726. * @return
  1727. */
  1728. @RequestMapping(value = "/deleteActivityCost", method = RequestMethod.POST)
  1729. public Result deleteActivityCost(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1730. Result res = new Result();
  1731. if (ids == null || ids.length < 1) {
  1732. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1733. } else {
  1734. res.setData(orgActivityCostService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
  1735. }
  1736. return res;
  1737. }
  1738. /**
  1739. * 获取当前用户已录入项目标号列表
  1740. *
  1741. * @param uid
  1742. * @return
  1743. */
  1744. @RequestMapping(value = "/activityNumber", method = RequestMethod.POST)
  1745. public Result listActivityNumber(String uid) {
  1746. Result res = new Result();
  1747. if (StringUtils.isBlank(uid)) {
  1748. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1749. return res;
  1750. }
  1751. List<ActivityNumberBo> activityNumberBo = orgActivityService.selectOrgActivityNumberBoByUid(uid);
  1752. res.setData(activityNumberBo);
  1753. return res;
  1754. }
  1755. /**
  1756. * 企业纳税申报信息列表
  1757. *
  1758. * @return
  1759. */
  1760. @RequestMapping(value = "/ratepay", method = RequestMethod.POST)
  1761. public Result ratepay(Integer year, String pageNo, String pageSize, String uid) {
  1762. Result res = new Result();
  1763. if (StringUtils.isBlank(uid)) {
  1764. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1765. return res;
  1766. }
  1767. if (!checkCertify(res, uid).getError().isEmpty()) {
  1768. return res;
  1769. }
  1770. Integer pNo = 1;
  1771. Integer pSize = 10;
  1772. if (StringUtils.isNumeric(pageSize)) {
  1773. pSize = Integer.parseInt(pageSize);
  1774. }
  1775. if (StringUtils.isNumeric(pageNo)) {
  1776. pNo = Integer.parseInt(pageNo);
  1777. }
  1778. res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, uid));
  1779. return res;
  1780. }
  1781. /**
  1782. * 企业纳税信息详情(获取同年度财务报表重复数据)
  1783. *
  1784. * @param uid
  1785. * @param year
  1786. * @return
  1787. */
  1788. @RequestMapping(value = "/ratepayDetail", method = RequestMethod.GET)
  1789. public Result ratepayDetail(String uid, Integer year) {
  1790. Result res = new Result();
  1791. if (null == uid) {
  1792. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1793. return res;
  1794. }
  1795. if (null == year) {
  1796. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1797. return res;
  1798. }
  1799. OrgFinance of = orgFinanceService.selectFinanceByUidAndYear(uid, year);
  1800. if (null != of) {
  1801. Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
  1802. map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), of.getGrossProfit());
  1803. map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), of.getManagementCost());
  1804. map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), of.getOperatingProfit());
  1805. map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), of.getResearchCost());
  1806. res.setData(map);
  1807. }
  1808. return res;
  1809. }
  1810. /**
  1811. * 企业纳税申报信息录入+修改
  1812. */
  1813. @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
  1814. public Result disposeRatepay(@Valid InputOrgRatepay orgRatepay, BindingResult bindingResult) {
  1815. Result res = new Result();
  1816. if (bindingResult.hasErrors()) {
  1817. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1818. OrgRatepayFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1819. return res;
  1820. }
  1821. if (StringUtils.isBlank(orgRatepay.getUid())) {
  1822. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1823. return res;
  1824. }
  1825. if (null == orgRatepay.getYear()) {
  1826. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1827. return res;
  1828. }
  1829. if (!checkCertify(res, orgRatepay.getUid()).getError().isEmpty()) {
  1830. return res;
  1831. }
  1832. OrgRatepay rate = new OrgRatepay();
  1833. BeanUtils.copyProperties(orgRatepay, rate);
  1834. if (StringUtils.isBlank(rate.getId())) {
  1835. if (null == orgRatepayService.selectRatepayByUidAndYear(rate.getUid(), rate.getYear())) {
  1836. rate.setId(UUID.randomUUID().toString());
  1837. rate.setDeletedSign(0);
  1838. orgRatepayService.insert(rate);
  1839. } else {
  1840. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
  1841. return res;
  1842. }
  1843. } else {
  1844. orgRatepayService.updateByPrimaryKeySelective(rate);
  1845. }
  1846. return res;
  1847. }
  1848. /**
  1849. * 企业纳税申报表上传
  1850. *
  1851. * @param req
  1852. * @param sign
  1853. * @param uid
  1854. * @return
  1855. */
  1856. @RequestMapping(value = "/uploadRatepay", method = RequestMethod.POST)
  1857. public Result uploadRatepay(HttpServletRequest req, String sign, String uid, String year) {
  1858. Result res = new Result();
  1859. User curUser = userService.selectByPrimaryKey(uid);
  1860. if (!checkCertify(res, curUser)) {
  1861. return res;
  1862. }
  1863. if (StringUtils.isBlank(year)) {
  1864. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  1865. return res;
  1866. }
  1867. AttachmentType attachmentType = AttachmentType.getField(sign);
  1868. if (attachmentType == AttachmentType.RATEPAY) {
  1869. sign = sign + "_" + year;
  1870. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  1871. } else {
  1872. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1873. }
  1874. return res;
  1875. }
  1876. /**
  1877. * 企业纳税申报表下载
  1878. *
  1879. * @param response
  1880. * @param sign
  1881. * @param id
  1882. * @return
  1883. */
  1884. @RequestMapping(value = "/downloadRatepay", method = RequestMethod.GET)
  1885. public Result downloadRatepay(HttpServletResponse response, String sign, String id) {
  1886. Result res = new Result();
  1887. if (StringUtils.isEmpty(id)) {
  1888. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
  1889. return res;
  1890. }
  1891. OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(id);
  1892. if (ratepay == null) {
  1893. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
  1894. return res;
  1895. }
  1896. AttachmentType attachmentType = AttachmentType.getField(sign);
  1897. if (attachmentType == AttachmentType.RATEPAY) {
  1898. downloadFile(response, ratepay.getTaxReturnDownloadFileName(), ratepay.getTaxReturnUrl());
  1899. } else {
  1900. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  1901. }
  1902. return res;
  1903. }
  1904. /**
  1905. * 刪除企业纳税申报信息
  1906. *
  1907. * @param ids
  1908. * @return
  1909. */
  1910. @RequestMapping(value = "/deleteRatepay", method = RequestMethod.POST)
  1911. public Result deleteRatepay(@RequestParam(name = "ids[]", required = false) String[] ids) {
  1912. Result res = new Result();
  1913. if (ids == null || ids.length < 1) {
  1914. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  1915. } else {
  1916. res.setData(orgRatepayService.deleteByPrimaryKey(Arrays.asList(ids)));
  1917. }
  1918. return res;
  1919. }
  1920. /**
  1921. * 财务报表信息列表
  1922. *
  1923. * @return
  1924. */
  1925. @RequestMapping(value = "/finance", method = RequestMethod.POST)
  1926. public Result finance(Integer year, String pageNo, String pageSize, String uid) {
  1927. Result res = new Result();
  1928. if (StringUtils.isBlank(uid)) {
  1929. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1930. return res;
  1931. }
  1932. if (!checkCertify(res, uid).getError().isEmpty()) {
  1933. return res;
  1934. }
  1935. Integer pNo = 1;
  1936. Integer pSize = 10;
  1937. if (StringUtils.isNumeric(pageSize)) {
  1938. pSize = Integer.parseInt(pageSize);
  1939. }
  1940. if (StringUtils.isNumeric(pageNo)) {
  1941. pNo = Integer.parseInt(pageNo);
  1942. }
  1943. res.setData(orgFinanceService.listFinance(year, pNo, pSize, uid));
  1944. return res;
  1945. }
  1946. /**
  1947. * 财务报表详情(获取同年度纳税申报表重复数据)
  1948. *
  1949. * @return
  1950. */
  1951. @RequestMapping(value = "/financeDetail", method = RequestMethod.GET)
  1952. public Result financeDetail(String uid, Integer year) {
  1953. Result res = new Result();
  1954. if (null == uid) {
  1955. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1956. return res;
  1957. }
  1958. if (null == year) {
  1959. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1960. return res;
  1961. }
  1962. OrgRatepay ratepay = orgRatepayService.selectRatepayByUidAndYear(uid, year);
  1963. if (null != ratepay) {
  1964. Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
  1965. map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), ratepay.getGrossProfit());
  1966. map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), ratepay.getManagementCost());
  1967. map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), ratepay.getOperatingProfit());
  1968. map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), ratepay.getResearchCost());
  1969. res.setData(map);
  1970. }
  1971. return res;
  1972. }
  1973. /**
  1974. * 财务报表录入+修改
  1975. *
  1976. * @param orgFinance
  1977. * @return
  1978. */
  1979. @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
  1980. public Result disposeFinance(@Valid InputOrgFinance orgFinance, BindingResult bindingResult) {
  1981. Result res = new Result();
  1982. if (bindingResult.hasErrors()) {
  1983. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  1984. OrgFinanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  1985. return res;
  1986. }
  1987. if (StringUtils.isBlank(orgFinance.getUid())) {
  1988. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  1989. return res;
  1990. }
  1991. if (null == orgFinance.getYear()) {
  1992. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
  1993. return res;
  1994. }
  1995. if (!checkCertify(res, orgFinance.getUid()).getError().isEmpty()) {
  1996. return res;
  1997. }
  1998. OrgFinance of = new OrgFinance();
  1999. BeanUtils.copyProperties(orgFinance, of);
  2000. if (StringUtils.isBlank(of.getId())) {
  2001. if (null == orgFinanceService.selectFinanceByUidAndYear(of.getUid(), of.getYear())) {
  2002. of.setId(UUID.randomUUID().toString());
  2003. of.setDeletedSign(0);
  2004. orgFinanceService.insert(of);
  2005. } else {
  2006. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
  2007. return res;
  2008. }
  2009. } else {
  2010. orgFinanceService.updateByPrimaryKeySelective(of);
  2011. }
  2012. return res;
  2013. }
  2014. /**
  2015. * 企业财务报表上传
  2016. *
  2017. * @param req
  2018. * @param sign
  2019. * @param uid
  2020. * @return
  2021. */
  2022. @RequestMapping(value = "/uploadFinance", method = RequestMethod.POST)
  2023. public Result uploadFinance(HttpServletRequest req, String sign, String uid, String year) {
  2024. Result res = new Result();
  2025. if (StringUtils.isBlank(year)) {
  2026. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
  2027. return res;
  2028. }
  2029. User curUser = userService.selectByPrimaryKey(uid);
  2030. if (!checkCertify(res, curUser)) {
  2031. return res;
  2032. }
  2033. AttachmentType attachmentType = AttachmentType.getField(sign);
  2034. if (attachmentType == AttachmentType.FINANCE) {
  2035. sign = sign + "_" + year;
  2036. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  2037. } else {
  2038. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2039. }
  2040. return res;
  2041. }
  2042. /**
  2043. * 企业财务报表下载
  2044. *
  2045. * @param response
  2046. * @param sign
  2047. * @param id
  2048. * @return
  2049. */
  2050. @RequestMapping(value = "/downloadFinance", method = RequestMethod.GET)
  2051. public Result downloadFinance(HttpServletResponse response, String sign, String id) {
  2052. Result res = new Result();
  2053. if (StringUtils.isEmpty(id)) {
  2054. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
  2055. return res;
  2056. }
  2057. OrgFinance of = orgFinanceService.selectByPrimaryKey(id);
  2058. if (of == null) {
  2059. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
  2060. return res;
  2061. }
  2062. AttachmentType attachmentType = AttachmentType.getField(sign);
  2063. if (attachmentType == AttachmentType.FINANCE) {
  2064. downloadFile(response, of.getFinanceDownloadFileName(), of.getFinanceUrl());
  2065. } else {
  2066. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2067. }
  2068. return res;
  2069. }
  2070. /**
  2071. * 删除财务报表
  2072. *
  2073. * @param ids
  2074. * @return
  2075. */
  2076. @RequestMapping(value = "/deleteFinance", method = RequestMethod.POST)
  2077. public Result deleteFinance(@RequestParam(name = "ids[]", required = false) String[] ids) {
  2078. Result res = new Result();
  2079. if (ids == null || ids.length < 1) {
  2080. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  2081. } else {
  2082. res.setData(orgFinanceService.deleteByPrimaryKey(Arrays.asList(ids)));
  2083. }
  2084. return res;
  2085. }
  2086. /**
  2087. * 科技成果转化情况列表
  2088. *
  2089. * @param pageNo
  2090. * @param pageSize
  2091. * @return
  2092. */
  2093. @RequestMapping(value = "/achievementList", method = RequestMethod.POST)
  2094. public Result achievementList(String pageNo, String pageSize, String uid) {
  2095. Result res = new Result();
  2096. if (StringUtils.isBlank(uid)) {
  2097. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2098. return res;
  2099. }
  2100. if (!checkCertify(res, uid).getError().isEmpty()) {
  2101. return res;
  2102. }
  2103. Integer pNo = 1;
  2104. Integer pSize = 10;
  2105. if (StringUtils.isNumeric(pageSize)) {
  2106. pSize = Integer.parseInt(pageSize);
  2107. }
  2108. if (StringUtils.isNumeric(pageNo)) {
  2109. pNo = Integer.parseInt(pageNo);
  2110. }
  2111. res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, uid));
  2112. return res;
  2113. }
  2114. /**
  2115. * 科技成果转化情况新增+修改
  2116. *
  2117. * @param achievement
  2118. * @return
  2119. * @throws ParseException
  2120. */
  2121. @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
  2122. public Result disposeAchievement(@Valid InputOrgTechAchievement achievement, BindingResult bindingResult) {
  2123. Result res = new Result();
  2124. if (bindingResult.hasErrors()) {
  2125. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2126. OrgTechAchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2127. return res;
  2128. }
  2129. if (StringUtils.isBlank(achievement.getUid())) {
  2130. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2131. return res;
  2132. }
  2133. if (!checkCertify(res, achievement.getUid()).getError().isEmpty()) {
  2134. return res;
  2135. }
  2136. OrgTechAchievement ota = new OrgTechAchievement();
  2137. BeanUtils.copyProperties(achievement, ota);
  2138. if (StringUtils.isBlank(ota.getId())) {
  2139. ota.setId(UUID.randomUUID().toString());
  2140. ota.setDeletedSign(0);
  2141. orgTechAchievementService.insert(ota);
  2142. } else {
  2143. orgTechAchievementService.updateByPrimaryKeySelective(ota);
  2144. }
  2145. return res;
  2146. }
  2147. /**
  2148. * 科技成果附件上传
  2149. *
  2150. * @param req
  2151. * @param sign
  2152. * @param uid
  2153. * @return
  2154. */
  2155. @RequestMapping(value = "/uploadAchievement", method = RequestMethod.POST)
  2156. public Result uploadAchievement(HttpServletRequest req, String sign, String uid) {
  2157. Result res = new Result();
  2158. User curUser = userService.selectByPrimaryKey(uid);
  2159. if (!checkCertify(res, curUser)) {
  2160. return res;
  2161. }
  2162. AttachmentType attachmentType = AttachmentType.getField(sign);
  2163. if (attachmentType == AttachmentType.ACHIEVEMENT) {
  2164. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  2165. } else {
  2166. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2167. }
  2168. return res;
  2169. }
  2170. /**
  2171. * 科技成果附件下载
  2172. *
  2173. * @param response
  2174. * @param sign
  2175. * @param id
  2176. * @return
  2177. */
  2178. @RequestMapping(value = "/downloadAchievement", method = RequestMethod.GET)
  2179. public Result downloadAchievement(HttpServletResponse response, String sign, String id) {
  2180. Result res = new Result();
  2181. if (StringUtils.isEmpty(id)) {
  2182. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
  2183. return res;
  2184. }
  2185. OrgTechAchievement ota = orgTechAchievementService.selectByPrimaryKey(id);
  2186. if (ota == null) {
  2187. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
  2188. return res;
  2189. }
  2190. AttachmentType attachmentType = AttachmentType.getField(sign);
  2191. if (attachmentType == AttachmentType.ACHIEVEMENT) {
  2192. downloadFile(response, ota.getEnclosureDownloadFileName(), ota.getEnclosureUrl());
  2193. } else {
  2194. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2195. }
  2196. return res;
  2197. }
  2198. /**
  2199. * 删除科技成果转化情况
  2200. *
  2201. * @param ids
  2202. * @return
  2203. */
  2204. @RequestMapping(value = "/deleteAchievement", method = RequestMethod.POST)
  2205. public Result deleteAchievement(@RequestParam(name = "ids[]", required = false) String[] ids) {
  2206. Result res = new Result();
  2207. if (ids == null || ids.length < 1) {
  2208. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  2209. } else {
  2210. res.setData(orgTechAchievementService.deleteByPrimaryKey(Arrays.asList(ids)));
  2211. }
  2212. return res;
  2213. }
  2214. /**
  2215. * 企业荣誉及其他证明材料列表
  2216. *
  2217. * @return
  2218. */
  2219. @RequestMapping(value = "/honorList", method = RequestMethod.POST)
  2220. public Result honorList(String pageNo, String pageSize, String uid) {
  2221. Result res = new Result();
  2222. if (StringUtils.isBlank(uid)) {
  2223. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2224. return res;
  2225. }
  2226. if (!checkCertify(res, uid).getError().isEmpty()) {
  2227. return res;
  2228. }
  2229. Integer pNo = 1;
  2230. Integer pSize = 10;
  2231. if (StringUtils.isNumeric(pageSize)) {
  2232. pSize = Integer.parseInt(pageSize);
  2233. }
  2234. if (StringUtils.isNumeric(pageNo)) {
  2235. pNo = Integer.parseInt(pageNo);
  2236. }
  2237. res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, uid));
  2238. return res;
  2239. }
  2240. /**
  2241. * 企业荣誉及其他证明材料新增+修改
  2242. *
  2243. * @param achievement
  2244. * @return
  2245. * @throws ParseException
  2246. */
  2247. @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
  2248. public Result disposeHonor(@Valid InputOrgHonorDatum honor, BindingResult bindingResult,
  2249. String issuingTimeFormattedDate) {
  2250. Result res = new Result();
  2251. if (bindingResult.hasErrors()) {
  2252. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2253. OrgHonorDatumFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2254. return res;
  2255. }
  2256. if (StringUtils.isBlank(honor.getUid())) {
  2257. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2258. return res;
  2259. }
  2260. if (null == honor.getYear()) {
  2261. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2262. return res;
  2263. }
  2264. if (!checkCertify(res, honor.getUid()).getError().isEmpty()) {
  2265. return res;
  2266. }
  2267. if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
  2268. try {
  2269. honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, AFTConstants.YYYYMMDD));
  2270. } catch (ParseException e) {
  2271. }
  2272. }
  2273. OrgHonorDatum ohd = new OrgHonorDatum();
  2274. BeanUtils.copyProperties(honor, ohd);
  2275. if (StringUtils.isBlank(ohd.getId())) {
  2276. ohd.setId(UUID.randomUUID().toString());
  2277. ohd.setDeletedSign(0);
  2278. orgHonorDatumService.insert(ohd);
  2279. } else {
  2280. orgHonorDatumService.updateByPrimaryKeySelective(ohd);
  2281. }
  2282. return res;
  2283. }
  2284. /**
  2285. * 荣誉及其他证明材料上传
  2286. *
  2287. * @param req
  2288. * @param sign
  2289. * @param uid
  2290. * @return
  2291. */
  2292. @RequestMapping(value = "/uploadHonor", method = RequestMethod.POST)
  2293. public Result uploadHonor(HttpServletRequest req, String sign, String uid) {
  2294. Result res = new Result();
  2295. User curUser = userService.selectByPrimaryKey(uid);
  2296. if (!checkCertify(res, curUser)) {
  2297. return res;
  2298. }
  2299. AttachmentType attachmentType = AttachmentType.getField(sign);
  2300. if (attachmentType == AttachmentType.HONOR) {
  2301. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  2302. } else {
  2303. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2304. }
  2305. return res;
  2306. }
  2307. /**
  2308. * 荣誉及其他证明材料下载
  2309. *
  2310. * @param response
  2311. * @param sign
  2312. * @param id
  2313. * @return
  2314. */
  2315. @RequestMapping(value = "/downloadHonor", method = RequestMethod.GET)
  2316. public Result downloadHonor(HttpServletResponse response, String sign, String id) {
  2317. Result res = new Result();
  2318. if (StringUtils.isEmpty(id)) {
  2319. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
  2320. return res;
  2321. }
  2322. OrgHonorDatum ohd = orgHonorDatumService.selectByPrimaryKey(id);
  2323. if (ohd == null) {
  2324. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
  2325. return res;
  2326. }
  2327. AttachmentType attachmentType = AttachmentType.getField(sign);
  2328. if (attachmentType == AttachmentType.HONOR) {
  2329. downloadFile(response, ohd.getEnclosureDownloadFileName(), ohd.getEnclosureUrl());
  2330. } else {
  2331. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2332. }
  2333. return res;
  2334. }
  2335. /**
  2336. * 删除企业荣誉及其他证明材料
  2337. *
  2338. * @param ids
  2339. * @return
  2340. */
  2341. @RequestMapping(value = "/deleteHonor", method = RequestMethod.POST)
  2342. public Result deleteHonor(@RequestParam(name = "ids[]", required = false) String[] ids) {
  2343. Result res = new Result();
  2344. if (ids == null || ids.length < 1) {
  2345. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  2346. } else {
  2347. res.setData(orgHonorDatumService.deleteByPrimaryKey(Arrays.asList(ids)));
  2348. }
  2349. return res;
  2350. }
  2351. /**
  2352. * 技术中心入口
  2353. *
  2354. * @return
  2355. */
  2356. @RequestMapping(value = "/center", method = RequestMethod.POST)
  2357. public Result center(String uid) {
  2358. Result res = new Result();
  2359. if (StringUtils.isBlank(uid)) {
  2360. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2361. return res;
  2362. }
  2363. if (!checkCertify(res, uid).getError().isEmpty()) {
  2364. return res;
  2365. }
  2366. res.setData(orgTechCenterService.selectOrgTechCenterByUid(uid));
  2367. return res;
  2368. }
  2369. /**
  2370. * 技术中心新增+修改
  2371. *
  2372. * @return
  2373. * @throws ParseException
  2374. */
  2375. @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
  2376. public Result disposeCenter(@Valid InputOrgTechCenter orgTechCenter, BindingResult bindingResult,
  2377. String foundingTimeFormattedDate) {
  2378. Result res = new Result();
  2379. if (bindingResult.hasErrors()) {
  2380. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2381. OrgTechCenterFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2382. return res;
  2383. }
  2384. if (StringUtils.isBlank(orgTechCenter.getUid())) {
  2385. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2386. return res;
  2387. }
  2388. if (!checkCertify(res, orgTechCenter.getUid()).getError().isEmpty()) {
  2389. return res;
  2390. }
  2391. if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
  2392. try {
  2393. orgTechCenter.setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, AFTConstants.YYYYMMDD));
  2394. } catch (ParseException e) {
  2395. }
  2396. }
  2397. OrgTechCenter otc = new OrgTechCenter();
  2398. BeanUtils.copyProperties(orgTechCenter, otc);
  2399. if (StringUtils.isBlank(otc.getId())) {
  2400. otc.setId(UUID.randomUUID().toString());
  2401. otc.setDeletedSign(0);
  2402. orgTechCenterService.insert(otc);
  2403. } else {
  2404. orgTechCenterService.updateByPrimaryKeySelective(otc);
  2405. }
  2406. return res;
  2407. }
  2408. /**
  2409. * 研发部门制度上传
  2410. *
  2411. * @param req
  2412. * @param sign
  2413. * @param uid
  2414. * @return
  2415. */
  2416. @RequestMapping(value = "/uploadInstitution", method = RequestMethod.POST)
  2417. public Result uploadInstitution(HttpServletRequest req, String sign, String uid) {
  2418. Result res = new Result();
  2419. User curUser = userService.selectByPrimaryKey(uid);
  2420. if (!checkCertify(res, curUser)) {
  2421. return res;
  2422. }
  2423. AttachmentType attachmentType = AttachmentType.getField(sign);
  2424. if (attachmentType == AttachmentType.INSTITUTION) {
  2425. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  2426. } else {
  2427. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2428. }
  2429. return res;
  2430. }
  2431. /**
  2432. * 研发部门制度下载
  2433. *
  2434. * @param response
  2435. * @param sign
  2436. * @param id
  2437. * @return
  2438. */
  2439. @RequestMapping(value = "/downloadInstitution", method = RequestMethod.GET)
  2440. public Result downloadInstitution(HttpServletResponse response, String sign, String id) {
  2441. Result res = new Result();
  2442. if (StringUtils.isEmpty(id)) {
  2443. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
  2444. return res;
  2445. }
  2446. OrgTechCenter otc = orgTechCenterService.selectByPrimaryKey(id);
  2447. if (otc == null) {
  2448. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
  2449. return res;
  2450. }
  2451. AttachmentType attachmentType = AttachmentType.getField(sign);
  2452. if (attachmentType == AttachmentType.INSTITUTION) {
  2453. downloadFile(response, otc.getSystemDownloadFileName(), otc.getSystemUrl());
  2454. } else {
  2455. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2456. }
  2457. return res;
  2458. }
  2459. /**
  2460. * 产学研情况列表
  2461. *
  2462. * @return
  2463. */
  2464. @RequestMapping(value = "/centerDetail", method = RequestMethod.GET)
  2465. public Result centerDetail(String pageNo, String pageSize, String cid) {
  2466. Result res = new Result();
  2467. Integer pNo = 1;
  2468. Integer pSize = 10;
  2469. if (StringUtils.isNumeric(pageSize)) {
  2470. pSize = Integer.parseInt(pageSize);
  2471. }
  2472. if (StringUtils.isNumeric(pageNo)) {
  2473. pNo = Integer.parseInt(pageNo);
  2474. }
  2475. res.setData(orgTechCenterDetailService.listOrgTechCenterDetail(pNo, pSize, cid));
  2476. return res;
  2477. }
  2478. /**
  2479. * 产学研情况新增+修改
  2480. *
  2481. * @param orgTechCenterDetail
  2482. * @param projectTimeFormattedDate
  2483. * @param termTimeFormattedDate
  2484. * @return
  2485. * @throws ParseException
  2486. */
  2487. @RequestMapping(value = "/disposeCenterDetail", method = RequestMethod.POST)
  2488. public Result disposeCenterDetail(@Valid InputOrgTechCenterDetail orgTechCenterDetail, BindingResult bindingResult,
  2489. String projectTimeFormattedDate, String termStartTimeFormattedDate, String termEndTimeFormattedDate) {
  2490. Result res = new Result();
  2491. if (bindingResult.hasErrors()) {
  2492. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2493. OrgTechCenterDetailFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2494. return res;
  2495. }
  2496. if (StringUtils.isBlank(orgTechCenterDetail.getCid())){
  2497. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "研发部门相关信息未保存,无法保存!"));
  2498. return res;
  2499. }
  2500. if (!StringUtils.isBlank(projectTimeFormattedDate)) {
  2501. try {
  2502. orgTechCenterDetail
  2503. .setProjectTime(DateUtils.parseDate(projectTimeFormattedDate, AFTConstants.YYYYMMDD));
  2504. } catch (ParseException e) {
  2505. }
  2506. }
  2507. if (!StringUtils.isBlank(termStartTimeFormattedDate)) {
  2508. try {
  2509. orgTechCenterDetail
  2510. .setTermStartTime(DateUtils.parseDate(termStartTimeFormattedDate, AFTConstants.YYYYMMDD));
  2511. } catch (ParseException e) {
  2512. }
  2513. }
  2514. if (!StringUtils.isBlank(termEndTimeFormattedDate)) {
  2515. try {
  2516. orgTechCenterDetail
  2517. .setTermEndTime(DateUtils.parseDate(termEndTimeFormattedDate, AFTConstants.YYYYMMDD));
  2518. } catch (ParseException e) {
  2519. }
  2520. }
  2521. OrgTechCenterDetail otcd = new OrgTechCenterDetail();
  2522. BeanUtils.copyProperties(orgTechCenterDetail, otcd);
  2523. if (StringUtils.isBlank(otcd.getId())) {
  2524. otcd.setId(UUID.randomUUID().toString());
  2525. otcd.setDeletedSign(0);
  2526. orgTechCenterDetailService.insert(otcd);
  2527. } else {
  2528. orgTechCenterDetailService.updateByPrimaryKeySelective(otcd);
  2529. }
  2530. return res;
  2531. }
  2532. /**
  2533. * 产学研技术中心协议上传
  2534. *
  2535. * @param req
  2536. * @param sign
  2537. * @param uid
  2538. * @return
  2539. */
  2540. @RequestMapping(value = "/uploadProtocol", method = RequestMethod.POST)
  2541. public Result uploadProtocol(HttpServletRequest req, String sign, String uid) {
  2542. Result res = new Result();
  2543. if (null == uid) {
  2544. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
  2545. return res;
  2546. }
  2547. User curUser = userService.selectByPrimaryKey(uid);
  2548. if (!checkCertify(res, curUser)) {
  2549. return res;
  2550. }
  2551. AttachmentType attachmentType = AttachmentType.getField(sign);
  2552. if (attachmentType == AttachmentType.PROTOCOL) {
  2553. res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
  2554. } else {
  2555. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2556. }
  2557. return res;
  2558. }
  2559. /**
  2560. * 产学研技术中心协议下载
  2561. *
  2562. * @param response
  2563. * @param sign
  2564. * @param id
  2565. * @return
  2566. */
  2567. @RequestMapping(value = "/downloadProtocol", method = RequestMethod.GET)
  2568. public Result downloadProtocol(HttpServletResponse response, String sign, String id) {
  2569. Result res = new Result();
  2570. if (StringUtils.isEmpty(id)) {
  2571. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
  2572. return res;
  2573. }
  2574. OrgTechCenterDetail otcd = orgTechCenterDetailService.selectByPrimaryKey(id);
  2575. if (otcd == null) {
  2576. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
  2577. return res;
  2578. }
  2579. AttachmentType attachmentType = AttachmentType.getField(sign);
  2580. if (attachmentType == AttachmentType.PROTOCOL) {
  2581. downloadFile(response, otcd.getProtocolDownloadFileName(), otcd.getProtocolUrl());
  2582. } else {
  2583. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
  2584. }
  2585. return res;
  2586. }
  2587. /**
  2588. * 删除技术中心明细
  2589. *
  2590. * @param ids
  2591. * @return
  2592. */
  2593. @RequestMapping(value = "/deleteOrgTechCenterDetail", method = RequestMethod.POST)
  2594. public Result deleteOrgTechCenterDetail(@RequestParam(name = "ids[]", required = false) String[] ids) {
  2595. Result res = new Result();
  2596. if (ids == null || ids.length < 1) {
  2597. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  2598. } else {
  2599. res.setData(orgTechCenterDetailService.deleteByPrimaryKey(Arrays.asList(ids)));
  2600. }
  2601. return res;
  2602. }
  2603. /**
  2604. * 获取公司联系人
  2605. *
  2606. * @return
  2607. */
  2608. @RequestMapping(value = "/getContacts", method = RequestMethod.GET)
  2609. public Result getContacts(String uid) {
  2610. Result res = new Result();
  2611. if (StringUtils.isBlank(uid)) {
  2612. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2613. return res;
  2614. }
  2615. res.setData(organizationIdentityService.selectContactsByUserId(uid));
  2616. return res;
  2617. }
  2618. /**
  2619. * 获取公司
  2620. */
  2621. @RequestMapping(value = "/getUnitNames", method = RequestMethod.GET)
  2622. public Result getUnitNames() {
  2623. Result res = new Result();
  2624. List<OrgUnitNames> list = organizationIdentityService.selectAllOrgIndentity();
  2625. Map<String, String> map = new TreeMap<String, String>();
  2626. for (OrgUnitNames o : list) {
  2627. map.put(o.getUid(), o.getUnitName());
  2628. }
  2629. res.setData(map);
  2630. return res;
  2631. }
  2632. /**
  2633. * 高企认定列表
  2634. *
  2635. * @param locationProvince
  2636. * @param unitName
  2637. * @return
  2638. */
  2639. @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
  2640. public Result listCognizance(String uid, String unitName, String locationProvince, String pageNo, String pageSize) {
  2641. Result res = new Result();
  2642. Integer pNo = 1;
  2643. Integer pSize = 10;
  2644. if (StringUtils.isNumeric(pageSize)) {
  2645. pSize = Integer.parseInt(pageSize);
  2646. }
  2647. if (StringUtils.isNumeric(pageNo)) {
  2648. pNo = Integer.parseInt(pageNo);
  2649. }
  2650. res.setData(orgCognizanceService.listCognizance(uid, unitName, locationProvince, pNo, pSize));
  2651. return res;
  2652. }
  2653. /**
  2654. * 高企认定咨询师下拉列表
  2655. *
  2656. * @return
  2657. */
  2658. @RequestMapping(value = "/getConsultant", method = RequestMethod.GET)
  2659. public Result getConsultant() {
  2660. Result res = new Result();
  2661. List<Admin> list = adminService.selectCognizanceConsultant();
  2662. Map<String, String> map = new TreeMap<String, String>();
  2663. for (Admin o : list) {
  2664. map.put(o.getId(), o.getName());
  2665. }
  2666. res.setData(map);
  2667. return res;
  2668. }
  2669. /**
  2670. * 高企负责人下拉
  2671. *
  2672. * @return
  2673. */
  2674. @RequestMapping(value = "/getPrincipal", method = RequestMethod.GET)
  2675. public Result getPrincipal() {
  2676. Result res = new Result();
  2677. List<Admin> list = adminService.selectCognizancePrincipal();
  2678. Map<String, String> map = new TreeMap<String, String>();
  2679. for (Admin o : list) {
  2680. map.put(o.getId(), o.getName());
  2681. }
  2682. res.setData(map);
  2683. return res;
  2684. }
  2685. /**
  2686. * 申请高企认定
  2687. *
  2688. * @return
  2689. */
  2690. @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
  2691. public Result applyCognizance(@Valid InputApplyCognizance cog, BindingResult bindingResult) {
  2692. Result res = new Result();
  2693. if (bindingResult.hasErrors()) {
  2694. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2695. CognizanceApplyFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2696. return res;
  2697. }
  2698. if (StringUtils.isBlank(cog.getUid())) {
  2699. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2700. return res;
  2701. }
  2702. if (null == cog.getYear()) {
  2703. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2704. return res;
  2705. }
  2706. if (!checkCertify(res, cog.getUid()).getError().isEmpty()) {
  2707. return res;
  2708. }
  2709. LatelyCogRecord lcr = orgCognizanceService.selectLatelyRecord(cog.getUid());
  2710. if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.FOSTER.getCode() == lcr.getState()) {
  2711. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企培育中!无法提交新申请!"));
  2712. return res;
  2713. }
  2714. if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() != lcr.getState()
  2715. && OrgCognizanceStatus.CALLBACK.getCode() != lcr.getState()) {
  2716. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
  2717. return res;
  2718. }
  2719. if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() == lcr.getState()) {
  2720. if (null == lcr.getIssuingDate()) {
  2721. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企认定未过期!无法提交新申请!"));
  2722. return res;
  2723. }
  2724. try {
  2725. if (Boolean.FALSE == TimeUtils.checkCogExpire(lcr.getIssuingDate())) {
  2726. res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企认定未过期,无法提交新申请!"));
  2727. return res;
  2728. }
  2729. } catch (ParseException e) {
  2730. }
  2731. }
  2732. OrgCognizance oc = new OrgCognizance();
  2733. BeanUtils.copyProperties(cog, oc);
  2734. orgCognizanceService.insertCognizance(oc, TokenManager.getAdminId());
  2735. return res;
  2736. }
  2737. /**
  2738. * 高企认定详情入口
  2739. *
  2740. * @param uid
  2741. * @param cid
  2742. * @return
  2743. */
  2744. @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
  2745. public Result cognizanceDetail(String uid, String cid, Integer year) {
  2746. Result res = new Result();
  2747. if (StringUtils.isBlank(uid)) {
  2748. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2749. return res;
  2750. }
  2751. if (StringUtils.isBlank(cid)) {
  2752. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2753. return res;
  2754. }
  2755. if (null == year) {
  2756. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2757. return res;
  2758. }
  2759. if (!checkCertify(res, uid).getError().isEmpty()) {
  2760. return res;
  2761. }
  2762. OrgCognizance oc = orgCognizanceService.selectByPrimaryKey(cid);
  2763. if (null == oc){
  2764. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID"));
  2765. return res;
  2766. }
  2767. if (year - oc.getYear() != 0){
  2768. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID及年份"));
  2769. return res;
  2770. }
  2771. res.setData(handleCognizanceDetail(uid, cid, year));
  2772. return res;
  2773. }
  2774. /**
  2775. * 高企认定流转状态下拉
  2776. *
  2777. * @return
  2778. */
  2779. @RequestMapping(value = "/cognizanceStatus", method = RequestMethod.GET)
  2780. public Result cognizanceStatus() {
  2781. Result res = new Result();
  2782. res.setData(disposeCognizanceStatus());
  2783. return res;
  2784. }
  2785. /**
  2786. * 高企认定流转状态
  2787. *
  2788. * @param cid
  2789. * @return
  2790. */
  2791. @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
  2792. public Result cognizanceLog(String cid) {
  2793. Result res = new Result();
  2794. if (StringUtils.isBlank(cid)) {
  2795. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
  2796. return res;
  2797. }
  2798. res.setData(orgCognizanceLogService.selectOrgCognizanceLogByCid(cid));
  2799. return res;
  2800. }
  2801. /**
  2802. * 保存高企认定详情
  2803. *
  2804. * @throws ParseException
  2805. */
  2806. @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
  2807. public Result disposeCognizanceDetail(@Valid InputOrgCognizance cog, BindingResult bindingResult,
  2808. String recordTimeFormattedDate) {
  2809. Result res = new Result();
  2810. if (bindingResult.hasErrors()) {
  2811. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2812. OrgCognizanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2813. return res;
  2814. }
  2815. if (StringUtils.isBlank(cog.getId())) {
  2816. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2817. return res;
  2818. }
  2819. if (null == cog.getYear()){
  2820. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "年份"));
  2821. return res;
  2822. }
  2823. OrgCognizance o = orgCognizanceService.selectByPrimaryKey(cog.getId());
  2824. if (null == o) {
  2825. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
  2826. return res;
  2827. }
  2828. if (OrgCognizanceStatus.CALLBACK.getCode() == o.getState()) {
  2829. res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
  2830. return res;
  2831. }
  2832. if (OrgCognizanceStatus.SETTLEMENT.getCode() == o.getState()) {
  2833. res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
  2834. return res;
  2835. }
  2836. if (!checkCertify(res, cog.getUid()).getError().isEmpty()) {
  2837. return res;
  2838. }
  2839. Date recordTime = null;
  2840. if (!StringUtils.isBlank(recordTimeFormattedDate)) {
  2841. try {
  2842. recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
  2843. } catch (ParseException e) {
  2844. }
  2845. }
  2846. OrgCognizance oc = new OrgCognizance();
  2847. OrgCognizanceLog ocl = new OrgCognizanceLog();
  2848. BeanUtils.copyProperties(cog, oc);
  2849. BeanUtils.copyProperties(cog, ocl);
  2850. orgCognizanceService.updateCognizance(oc, ocl, recordTime, TokenManager.getAdminId());
  2851. return res;
  2852. }
  2853. /**
  2854. * 刪除高企认定
  2855. *
  2856. * @param ids
  2857. * @return
  2858. */
  2859. @RequestMapping(value = "/deleteCognizance", method = RequestMethod.POST)
  2860. public Result deleteCognizance(@RequestParam(name = "ids[]", required = false) String[] ids) {
  2861. Result res = new Result();
  2862. if (ids == null || ids.length < 1) {
  2863. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  2864. } else {
  2865. res.setData(orgCognizanceService.deleteByPrimaryKey(Arrays.asList(ids)));
  2866. }
  2867. return res;
  2868. }
  2869. /**
  2870. * 企业创新能力入口
  2871. *
  2872. * @param uid
  2873. * @return
  2874. */
  2875. @RequestMapping(value = "/able", method = RequestMethod.POST)
  2876. public Result able(String uid) {
  2877. Result res = new Result();
  2878. if (StringUtils.isBlank(uid)) {
  2879. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2880. return res;
  2881. }
  2882. res.setData(userAbilityService.selectUserAbilityByUserId(uid));
  2883. return res;
  2884. }
  2885. /**
  2886. * 企业创新能力新增+保存
  2887. *
  2888. * @param u
  2889. * @return
  2890. */
  2891. @RequestMapping(value = "/disposeAble", method = RequestMethod.POST)
  2892. public Result disposeAble(@Valid InputUserAbility u, BindingResult bindingResult) {
  2893. Result res = new Result();
  2894. if (bindingResult.hasErrors()) {
  2895. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2896. UserAbilityFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2897. return res;
  2898. }
  2899. if (StringUtils.isBlank(u.getUid())) {
  2900. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2901. return res;
  2902. }
  2903. UserAbility user = new UserAbility();
  2904. BeanUtils.copyProperties(u, user);
  2905. if (StringUtils.isBlank(user.getId())) {
  2906. user.setId(UUID.randomUUID().toString());
  2907. userAbilityService.insert(user);
  2908. } else {
  2909. userAbilityService.updateByPrimaryKeySelective(user);
  2910. }
  2911. return res;
  2912. }
  2913. /**
  2914. * 年报列表
  2915. *
  2916. * @return
  2917. */
  2918. @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
  2919. public Result annualReport(String uid, Integer year, Integer state, String pageSize, String pageNo) {
  2920. Result res = new Result();
  2921. res = checkCertify(res, uid);
  2922. if (res.getError().isEmpty()) {
  2923. Integer pNo = 1;
  2924. Integer pSize = 10;
  2925. if (StringUtils.isNumeric(pageSize)) {
  2926. pSize = Integer.parseInt(pageSize);
  2927. }
  2928. if (StringUtils.isNumeric(pageNo)) {
  2929. pNo = Integer.parseInt(pageNo);
  2930. }
  2931. res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, uid));
  2932. }
  2933. return res;
  2934. }
  2935. /**
  2936. * 企业年报详情
  2937. *
  2938. * @param uid
  2939. * @param year
  2940. * @return
  2941. */
  2942. @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
  2943. public Result annualReportDetail(String uid, Integer year) {
  2944. Result res = new Result();
  2945. if (StringUtils.isBlank(uid)) {
  2946. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2947. return res;
  2948. }
  2949. if (null == year) {
  2950. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
  2951. return res;
  2952. }
  2953. if (!checkCertify(res, uid).getError().isEmpty()) {
  2954. return res;
  2955. }
  2956. res.setData(handleAnnualReport(uid, year));
  2957. return res;
  2958. }
  2959. /**
  2960. * 高企年报新增+修改
  2961. *
  2962. * @param orgAnnualReport
  2963. * @return
  2964. */
  2965. @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
  2966. public Result disposeAnnualReport(@Valid InputOrgAnnualReport orgAnnualReport, BindingResult bindingResult) {
  2967. Result res = new Result();
  2968. if (bindingResult.hasErrors()) {
  2969. res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
  2970. OrgAnnualReportFields.getFieldDesc(bindingResult.getFieldError().getField())));
  2971. return res;
  2972. }
  2973. if (StringUtils.isBlank(orgAnnualReport.getUid())) {
  2974. res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
  2975. return res;
  2976. }
  2977. if (!checkCertify(res, orgAnnualReport.getUid()).getError().isEmpty()) {
  2978. res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
  2979. return res;
  2980. }
  2981. OrgAnnualReport oar = new OrgAnnualReport();
  2982. BeanUtils.copyProperties(orgAnnualReport, oar);
  2983. if (StringUtils.isBlank(oar.getId())) {
  2984. if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(oar.getYear(), oar.getUid())) {
  2985. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
  2986. return res;
  2987. } else {
  2988. oar.setId(UUID.randomUUID().toString());
  2989. Calendar now = Calendar.getInstance();
  2990. now.set(Calendar.MILLISECOND, 0);
  2991. oar.setCreateTime(now.getTime());
  2992. oar.setLastUpdateTime(oar.getCreateTime());
  2993. oar.setDeletedSign(0);
  2994. orgAnnualReportService.insert(oar);
  2995. }
  2996. } else {
  2997. Calendar now = Calendar.getInstance();
  2998. now.set(Calendar.MILLISECOND, 0);
  2999. oar.setLastUpdateTime(now.getTime());
  3000. orgAnnualReportService.updateByPrimaryKeySelective(oar);
  3001. }
  3002. return res;
  3003. }
  3004. /**
  3005. * 删除企业年报记录
  3006. *
  3007. * @param ids
  3008. * @return
  3009. */
  3010. @RequestMapping(value = "/deleteAnnualReport", method = RequestMethod.POST)
  3011. public Result deleteAnnualReport(@RequestParam(name = "ids[]", required = false) String[] ids) {
  3012. Result res = new Result();
  3013. if (ids == null || ids.length < 1) {
  3014. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
  3015. } else {
  3016. res.setData(orgAnnualReportService.deleteByPrimaryKey(Arrays.asList(ids)));
  3017. }
  3018. return res;
  3019. }
  3020. /**
  3021. * 高企培育列表
  3022. *
  3023. * @param pageNo
  3024. * @param pageSize
  3025. * @return
  3026. */
  3027. @RequestMapping(value = "/cultivate", method = RequestMethod.POST)
  3028. public Result cultivationList(String uid, String province, String unitName, String pageNo, String pageSize) {
  3029. Result res = new Result();
  3030. Integer pNo = 1;
  3031. Integer pSize = 10;
  3032. if (StringUtils.isNumeric(pageSize)) {
  3033. pSize = Integer.parseInt(pageSize);
  3034. }
  3035. if (StringUtils.isNumeric(pageNo)) {
  3036. pNo = Integer.parseInt(pageNo);
  3037. }
  3038. res.setData(orgCognizanceService.listCultivation(uid, province, unitName, pNo, pSize));
  3039. return res;
  3040. }
  3041. // 判断用户是否通过认证
  3042. private Result checkCertify(Result res, String uid) {
  3043. OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(uid);
  3044. if (null == o || 5 != o.getAuditStatus()) {
  3045. res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
  3046. }
  3047. return res;
  3048. }
  3049. // org团体列表
  3050. private Pagination<OrgListBo> getOrgList(String uid, String mobile, String email, String[] createTime,
  3051. Integer number, String unitName, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
  3052. return userService.listOrg(uid, mobile, email, createTime, number, unitName, auditStatus, pNo, pSize);
  3053. }
  3054. // user个人列表
  3055. private Pagination<UserListBo> getUserList(String mobile, String email, String[] createTime, Integer number,
  3056. String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
  3057. return userService.listUser(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
  3058. }
  3059. // 高企详情
  3060. private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
  3061. return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
  3062. }
  3063. // 年报
  3064. private AnnualReportBo handleAnnualReport(String uid, Integer year) {
  3065. return orgAnnualReportService.selectAnnualReportBo(uid, year);
  3066. }
  3067. private Map<String, String> disposeCognizanceStatus() {
  3068. Map<String, String> status = new TreeMap<String, String>();
  3069. if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  3070. for (OrgCognizanceStatus p : OrgCognizanceStatus.values()) {
  3071. status.put(p.getCode().toString(), p.getDesc());
  3072. status.remove(OrgCognizanceStatus.OTHER.getCode().toString());
  3073. }
  3074. } else {
  3075. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CREATE.getCode())) {
  3076. status.put(OrgCognizanceStatus.CREATE.getCode().toString(), OrgCognizanceStatus.CREATE.getDesc());
  3077. }
  3078. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SIGN.getCode())) {
  3079. status.put(OrgCognizanceStatus.SIGN.getCode().toString(), OrgCognizanceStatus.SIGN.getDesc());
  3080. }
  3081. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.DELIVERD.getCode())) {
  3082. status.put(OrgCognizanceStatus.DELIVERD.getCode().toString(), OrgCognizanceStatus.DELIVERD.getDesc());
  3083. }
  3084. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CIRCULATION.getCode())) {
  3085. status.put(OrgCognizanceStatus.CIRCULATION.getCode().toString(),
  3086. OrgCognizanceStatus.CIRCULATION.getDesc());
  3087. }
  3088. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.PREPARE.getCode())) {
  3089. status.put(OrgCognizanceStatus.PREPARE.getCode().toString(), OrgCognizanceStatus.PREPARE.getDesc());
  3090. }
  3091. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SUBMIT.getCode())) {
  3092. status.put(OrgCognizanceStatus.SUBMIT.getCode().toString(), OrgCognizanceStatus.SUBMIT.getDesc());
  3093. }
  3094. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.ACCEPT.getCode())) {
  3095. status.put(OrgCognizanceStatus.ACCEPT.getCode().toString(), OrgCognizanceStatus.ACCEPT.getDesc());
  3096. }
  3097. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.APPRVOVED.getCode())) {
  3098. status.put(OrgCognizanceStatus.APPRVOVED.getCode().toString(), OrgCognizanceStatus.APPRVOVED.getDesc());
  3099. }
  3100. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.REJECT.getCode())) {
  3101. status.put(OrgCognizanceStatus.REJECT.getCode().toString(), OrgCognizanceStatus.REJECT.getDesc());
  3102. }
  3103. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.ISSUING.getCode())) {
  3104. status.put(OrgCognizanceStatus.ISSUING.getCode().toString(), OrgCognizanceStatus.ISSUING.getDesc());
  3105. }
  3106. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.EXPIRED.getCode())) {
  3107. status.put(OrgCognizanceStatus.EXPIRED.getCode().toString(), OrgCognizanceStatus.EXPIRED.getDesc());
  3108. }
  3109. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.FOSTER.getCode())) {
  3110. status.put(OrgCognizanceStatus.FOSTER.getCode().toString(), OrgCognizanceStatus.FOSTER.getDesc());
  3111. }
  3112. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SETTLEMENT.getCode())) {
  3113. status.put(OrgCognizanceStatus.SETTLEMENT.getCode().toString(),
  3114. OrgCognizanceStatus.SETTLEMENT.getDesc());
  3115. }
  3116. if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CALLBACK.getCode())) {
  3117. status.put(OrgCognizanceStatus.CALLBACK.getCode().toString(), OrgCognizanceStatus.CALLBACK.getDesc());
  3118. }
  3119. }
  3120. return status;
  3121. }
  3122. private OrgCognizanceProportion disposeProportionStatus(String sign, Integer status, OrgCognizanceProportion ocp) {
  3123. if (ProprotionFields.INSTITUTION.getCode().equals(sign)) {
  3124. if (ProportionStatus.FINISHED.getCode() == status) {
  3125. ocp.setInstitution(ProportionStatus.FINISHED.getCode());
  3126. } else {
  3127. ocp.setInstitution(ProportionStatus.UNFINISHED.getCode());
  3128. }
  3129. } else if (ProprotionFields.ACTIVITY.getCode().equals(sign)) {
  3130. if (ProportionStatus.FINISHED.getCode() == status) {
  3131. ocp.setActivity(ProportionStatus.FINISHED.getCode());
  3132. } else {
  3133. ocp.setActivity(ProportionStatus.UNFINISHED.getCode());
  3134. }
  3135. } else if (ProprotionFields.ACTIVITYCOST.getCode().equals(sign)) {
  3136. if (ProportionStatus.FINISHED.getCode() == status) {
  3137. ocp.setActivityCost(ProportionStatus.FINISHED.getCode());
  3138. } else {
  3139. ocp.setActivityCost(ProportionStatus.UNFINISHED.getCode());
  3140. }
  3141. } else if (ProprotionFields.TECHPROJECT.getCode().equals(sign)) {
  3142. if (ProportionStatus.FINISHED.getCode() == status) {
  3143. ocp.setTechProject(ProportionStatus.FINISHED.getCode());
  3144. } else {
  3145. ocp.setTechProject(ProportionStatus.UNFINISHED.getCode());
  3146. }
  3147. } else if (ProprotionFields.INTELLECTUALPROPERTY.getCode().equals(sign)) {
  3148. if (ProportionStatus.FINISHED.getCode() == status) {
  3149. ocp.setIntellectualProperty(ProportionStatus.FINISHED.getCode());
  3150. } else {
  3151. ocp.setIntellectualProperty(ProportionStatus.UNFINISHED.getCode());
  3152. }
  3153. } else if (ProprotionFields.ACHIEVEMENT.getCode().equals(sign)) {
  3154. if (ProportionStatus.FINISHED.getCode() == status) {
  3155. ocp.setAchievement(ProportionStatus.FINISHED.getCode());
  3156. } else {
  3157. ocp.setAchievement(ProportionStatus.UNFINISHED.getCode());
  3158. }
  3159. } else if (ProprotionFields.RATEPAY.getCode().equals(sign)) {
  3160. if (ProportionStatus.FINISHED.getCode() == status) {
  3161. ocp.setRatepay(ProportionStatus.FINISHED.getCode());
  3162. } else {
  3163. ocp.setRatepay(ProportionStatus.UNFINISHED.getCode());
  3164. }
  3165. } else if (ProprotionFields.FINANCE.getCode().equals(sign)) {
  3166. if (ProportionStatus.FINISHED.getCode() == status) {
  3167. ocp.setFinance(ProportionStatus.FINISHED.getCode());
  3168. } else {
  3169. ocp.setFinance(ProportionStatus.UNFINISHED.getCode());
  3170. }
  3171. } else if (ProprotionFields.HUMANRESOURCE.getCode().equals(sign)) {
  3172. if (ProportionStatus.FINISHED.getCode() == status) {
  3173. ocp.setHumanResource(ProportionStatus.FINISHED.getCode());
  3174. } else {
  3175. ocp.setHumanResource(ProportionStatus.UNFINISHED.getCode());
  3176. }
  3177. } else if (ProprotionFields.HONORDATUM.getCode().equals(sign)) {
  3178. if (ProportionStatus.FINISHED.getCode() == status) {
  3179. ocp.setHonorDatum(ProportionStatus.FINISHED.getCode());
  3180. } else {
  3181. ocp.setHonorDatum(ProportionStatus.UNFINISHED.getCode());
  3182. }
  3183. } else if (ProprotionFields.STANDARD.getCode().equals(sign)) {
  3184. if (ProportionStatus.FINISHED.getCode() == status) {
  3185. ocp.setStandard(ProportionStatus.FINISHED.getCode());
  3186. } else {
  3187. ocp.setStandard(ProportionStatus.UNFINISHED.getCode());
  3188. }
  3189. } else if (ProprotionFields.ABILITY.getCode().equals(sign)) {
  3190. if (ProportionStatus.FINISHED.getCode() == status) {
  3191. ocp.setAbility(ProportionStatus.FINISHED.getCode());
  3192. } else {
  3193. ocp.setAbility(ProportionStatus.UNFINISHED.getCode());
  3194. }
  3195. }
  3196. return ocp;
  3197. }
  3198. /*
  3199. * @Test public void test () throws IllegalArgumentException,
  3200. * IllegalAccessException{ Admin a = new Admin(); import
  3201. * java.lang.reflect.Field; boolean flag = Boolean.FALSE; for(Field f :
  3202. * a.getClass().getDeclaredFields()){ f.setAccessible(true); if(f.get(a) ==
  3203. * null){ flag = true; } } }
  3204. */
  3205. }