AdminApiController.java 115 KB

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