AdminApiController.java 107 KB

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