AdminApiController.java 110 KB

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