AdminApiController.java 111 KB

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