AdminApiController.java 105 KB

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