AdminApiController.java 114 KB

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