AdminApiController.java 90 KB

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