AdminApiController.java 114 KB

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