| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515 |
- package com.goafanti.admin.controller;
- import java.math.BigDecimal;
- import java.text.ParseException;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.TreeMap;
- import java.util.UUID;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.validation.Valid;
- import org.springframework.beans.BeanUtils;
- import org.springframework.stereotype.Controller;
- import org.springframework.validation.BindingResult;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import com.goafanti.admin.bo.AdminDetail;
- import com.goafanti.admin.bo.InputAdmin;
- import com.goafanti.admin.service.AdminService;
- import com.goafanti.cognizance.bo.ActivityNumberBo;
- import com.goafanti.cognizance.bo.AnnualReportBo;
- import com.goafanti.cognizance.bo.CognizanceDetailBo;
- import com.goafanti.cognizance.bo.InputApplyCognizance;
- import com.goafanti.cognizance.bo.InputOrgActivity;
- import com.goafanti.cognizance.bo.InputOrgActivityCost;
- import com.goafanti.cognizance.bo.InputOrgAnnualReport;
- import com.goafanti.cognizance.bo.InputOrgCognizance;
- import com.goafanti.cognizance.bo.InputOrgFinance;
- import com.goafanti.cognizance.bo.InputOrgHonorDatum;
- import com.goafanti.cognizance.bo.InputOrgHumanResource;
- import com.goafanti.cognizance.bo.InputOrgIntellectualProperty;
- import com.goafanti.cognizance.bo.InputOrgRatepay;
- import com.goafanti.cognizance.bo.InputOrgStandard;
- import com.goafanti.cognizance.bo.InputOrgTechAchievement;
- import com.goafanti.cognizance.bo.InputOrgTechCenter;
- import com.goafanti.cognizance.bo.InputOrgTechCenterDetail;
- import com.goafanti.cognizance.bo.InputOrgTechProduct;
- import com.goafanti.cognizance.bo.LatelyCogRecord;
- import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
- import com.goafanti.cognizance.service.OrgActivityCostService;
- import com.goafanti.cognizance.service.OrgActivityService;
- import com.goafanti.cognizance.service.OrgAnnualReportService;
- import com.goafanti.cognizance.service.OrgCognizanceLogService;
- import com.goafanti.cognizance.service.OrgCognizanceProportionService;
- import com.goafanti.cognizance.service.OrgCognizanceService;
- import com.goafanti.cognizance.service.OrgFinanceService;
- import com.goafanti.cognizance.service.OrgHonorDatumService;
- import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
- import com.goafanti.cognizance.service.OrgRatepayService;
- import com.goafanti.cognizance.service.OrgStandardService;
- import com.goafanti.cognizance.service.OrgTechAchievementService;
- import com.goafanti.cognizance.service.OrgTechCenterDetailService;
- import com.goafanti.cognizance.service.OrgTechCenterService;
- import com.goafanti.cognizance.service.OrgTechProductService;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.CertifyApiController;
- import com.goafanti.common.enums.AdminFields;
- import com.goafanti.common.enums.AttachmentType;
- import com.goafanti.common.enums.CognizanceApplyFields;
- import com.goafanti.common.enums.FinanceRatepayFields;
- import com.goafanti.common.enums.IdentityAuditStatus;
- import com.goafanti.common.enums.IdentityProcess;
- import com.goafanti.common.enums.IntellectualPropertyType;
- import com.goafanti.common.enums.OrgActivityFields;
- import com.goafanti.common.enums.OrgAnnualReportFields;
- import com.goafanti.common.enums.OrgCognizanceFields;
- import com.goafanti.common.enums.OrgCognizanceStatus;
- import com.goafanti.common.enums.OrgFinanceFields;
- import com.goafanti.common.enums.OrgHonorDatumFields;
- import com.goafanti.common.enums.OrgHumanResourceFields;
- import com.goafanti.common.enums.OrgIntellectualPropertyFields;
- import com.goafanti.common.enums.OrgRatepayFields;
- import com.goafanti.common.enums.OrgStandardFields;
- import com.goafanti.common.enums.OrgTechAchievementFields;
- import com.goafanti.common.enums.OrgTechCenterDetailFields;
- import com.goafanti.common.enums.OrgTechCenterFields;
- import com.goafanti.common.enums.OrgTechProductFields;
- import com.goafanti.common.enums.OrganizationIdentityFields;
- import com.goafanti.common.enums.ProportionStatus;
- import com.goafanti.common.enums.ProprotionFields;
- import com.goafanti.common.enums.UserAbilityFields;
- import com.goafanti.common.enums.UserFields;
- import com.goafanti.common.enums.UserIdentityFields;
- import com.goafanti.common.model.Admin;
- import com.goafanti.common.model.OrgActivity;
- import com.goafanti.common.model.OrgActivityCost;
- import com.goafanti.common.model.OrgAnnualReport;
- import com.goafanti.common.model.OrgCognizance;
- import com.goafanti.common.model.OrgCognizanceLog;
- import com.goafanti.common.model.OrgCognizanceProportion;
- import com.goafanti.common.model.OrgFinance;
- import com.goafanti.common.model.OrgHonorDatum;
- import com.goafanti.common.model.OrgHumanResource;
- import com.goafanti.common.model.OrgIntellectualProperty;
- import com.goafanti.common.model.OrgRatepay;
- import com.goafanti.common.model.OrgStandard;
- import com.goafanti.common.model.OrgTechAchievement;
- import com.goafanti.common.model.OrgTechCenter;
- import com.goafanti.common.model.OrgTechCenterDetail;
- import com.goafanti.common.model.OrgTechProduct;
- import com.goafanti.common.model.OrganizationIdentity;
- import com.goafanti.common.model.PatentInfo;
- import com.goafanti.common.model.User;
- import com.goafanti.common.model.UserAbility;
- import com.goafanti.common.model.UserIdentity;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.common.utils.PasswordUtil;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.common.utils.TimeUtils;
- import com.goafanti.copyright.bo.CopyrightInfoDetail;
- import com.goafanti.copyright.service.CopyrightInfoService;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.patent.service.PatentInfoService;
- import com.goafanti.user.bo.InputOrganizationIdentity;
- import com.goafanti.user.bo.InputUser;
- import com.goafanti.user.bo.InputUserAbility;
- import com.goafanti.user.bo.InputUserIdentity;
- import com.goafanti.user.bo.OrgListBo;
- import com.goafanti.user.bo.UserListBo;
- import com.goafanti.user.service.OrgHumanResourceService;
- import com.goafanti.user.service.OrganizationIdentityService;
- import com.goafanti.user.service.UserAbilityService;
- import com.goafanti.user.service.UserIdentityService;
- import com.goafanti.user.service.UserService;
- @Controller
- @RequestMapping(value = "/api/admin")
- public class AdminApiController extends CertifyApiController {
- @Resource
- private UserService userService;
- @Resource
- private UserIdentityService userIdentityService;
- @Resource
- private OrganizationIdentityService organizationIdentityService;
- @Resource
- private OrgHumanResourceService orgHumanResourceService;
- @Resource
- private OrgStandardService orgStandardService;
- @Resource
- private OrgIntellectualPropertyService orgIntellectualPropertyService;
- @Resource
- private OrgTechProductService orgTechProductService;
- @Resource
- private OrgRatepayService orgRatepayService;
- @Resource
- private OrgFinanceService orgFinanceService;
- @Resource
- private OrgActivityService orgActivityService;
- @Resource
- private OrgActivityCostService orgActivityCostService;
- @Resource
- private OrgTechAchievementService orgTechAchievementService;
- @Resource
- private OrgHonorDatumService orgHonorDatumService;
- @Resource
- private OrgTechCenterService orgTechCenterService;
- @Resource
- private OrgCognizanceService orgCognizanceService;
- @Resource
- private OrgCognizanceLogService orgCognizanceLogService;
- @Resource
- private UserAbilityService userAbilityService;
- @Resource
- private OrgAnnualReportService orgAnnualReportService;
- @Resource(name = "passwordUtil")
- private PasswordUtil passwordUtil;
- @Resource
- private AdminService adminService;
- @Resource
- private OrgTechCenterDetailService orgTechCenterDetailService;
- @Resource
- private PatentInfoService patentInfoService;
- @Resource
- private CopyrightInfoService copyrightInfoService;
- @Resource
- private OrgCognizanceProportionService orgCognizanceProportionService;
- /**
- * 更改资料填写完成状态
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/confirmProportion", method = RequestMethod.POST)
- public Result confirmProportion(String id, String uid, String sign, Integer status) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户ID"));
- return res;
- }
- if (StringUtils.isBlank(sign)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到类别标记", "类别标记"));
- return res;
- }
- if (null == status) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到资料完成状态", "资料完成状态"));
- return res;
- }
- if (ProportionStatus.FINISHED.getCode() != status && ProportionStatus.UNFINISHED.getCode() != status) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "资料完成状态"));
- return res;
- }
-
- if (null == id){
- OrgCognizanceProportion cp = new OrgCognizanceProportion();
- cp.setId(UUID.randomUUID().toString());
- cp.setUid(uid);
- res.setData(orgCognizanceProportionService.insert(disposeProportionStatus(sign, status, cp)));
- return res;
- }
- OrgCognizanceProportion ocp = orgCognizanceProportionService.selectByPrimaryKey(id);
- if (null == ocp) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "比重ID"));
- return res;
- }
- res.setData(orgCognizanceProportionService.updateByPrimaryKeySelective(disposeProportionStatus(sign, status, ocp)));
- return res;
- }
- /**
- * 高企培育资料完成情况(比重)
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/proportion", method = RequestMethod.GET)
- public Result proportion(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
- return res;
- }
- res.setData(orgCognizanceProportionService.selectByUid(uid));
- return res;
- }
- /**
- * 管理员角色
- */
- @RequestMapping(value = "/role", method = RequestMethod.GET)
- public Result getRole(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "管理员ID"));
- return res;
- }
- res.setData(adminService.selectRoleByPrimaryKey(uid));
- return res;
- }
- /**
- * 管理员"我的客户"列表
- *
- * @return
- */
- @RequestMapping(value = "/customer", method = RequestMethod.GET)
- public Result getCustomer() {
- Result res = new Result();
- res.setData(userService.selectUserByAid(TokenManager.getAdminId()));
- return res;
- }
- /**
- * 管理员本人信息详情
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/adminInfo", method = RequestMethod.GET)
- public Result adminInfo() {
- Result res = new Result();
- if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "超级管理员"));
- return res;
- }
- res.setData(adminService.selectByPrimaryKey(TokenManager.getAdminId()));
- return res;
- }
- /**
- * 管理员修改本人信息
- *
- * @param admin
- * @param bindingResult
- * @return
- */
- @RequestMapping(value = "/updateAdminInfo", method = RequestMethod.POST)
- public Result updateAdminInfo(@Valid InputAdmin admin, String pwd, BindingResult bindingResult) {
- Result res = new Result();
- if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "超级管理员"));
- return res;
- }
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(admin.getId())) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- if (StringUtils.isBlank(admin.getMobile())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
- return res;
- }
- if (StringUtils.isBlank(admin.getName())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
- return res;
- }
- Admin a = adminService.selectByMobile(admin.getMobile().trim());
- if (!TokenManager.getAdminId().equals(a.getId())) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- Admin ad = new Admin();
- BeanUtils.copyProperties(admin, ad);
- Admin aa = adminService.selectByPrimaryKey(TokenManager.getAdminId());
- ad.setMobile(ad.getMobile().trim());
- ad.setCreateTime(aa.getCreateTime());
- if (!StringUtils.isBlank(ad.getPassword())) {
- if (StringUtils.isBlank(pwd)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "原密码"));
- return res;
- }
- if (!aa.getPassword().equals(passwordUtil.getEncryptPwd(pwd, aa.getCreateTime()))) {
- res.getError().add(buildError(ErrorConstants.PWD_NOT_MATCH_ERROR, "", "原密码"));
- return res;
- }
- } else {
- ad.setPassword(aa.getPassword());
- }
- ad.setPassword(passwordUtil.getEncryptPwd(ad));
- res.setData(adminService.updateByPrimaryKey(ad));
- return res;
- }
- /**
- * 管理员列表
- *
- * @param province
- * @param number
- * @param mobile
- * @param name
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/adminList", method = RequestMethod.GET)
- public Result adminList(String province, Integer number, String mobile, String name, String pageNo,
- String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(adminService.listAdmin(province, number, mobile, name, pNo, pSize));
- return res;
- }
- /**
- * 新增管理员
- *
- * @param admin
- * @param bindingResult
- * @return
- */
- @RequestMapping(value = "/insertAdmin", method = RequestMethod.POST)
- public Result insertAdmin(@Valid InputAdmin admin, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(admin.getMobile())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
- return res;
- }
- if (StringUtils.isBlank(admin.getName())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
- return res;
- }
- Admin a = adminService.selectByMobile(admin.getMobile().trim());
- if (null != a) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- Admin ad = new Admin();
- BeanUtils.copyProperties(admin, ad);
- ad.setId(UUID.randomUUID().toString());
- ad.setCreateTime(now.getTime());
- if (StringUtils.isBlank(ad.getPassword())) {
- ad.setPassword("123456");
- }
- ad.setPassword(passwordUtil.getEncryptPwd(ad));
- adminService.insert(ad);
- return res;
- }
- /**
- * 管理员详情
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/adminDetail", method = RequestMethod.GET)
- public Result adminDetail(String id) {
- Result res = new Result();
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- AdminDetail ad = adminService.selectAdminDetail(id);
- res.setData(ad);
- return res;
- }
- /**
- * 修改管理员信息
- *
- * @param admin
- * @param bindingResult
- * @return
- */
- @RequestMapping(value = "/updateAdmin", method = RequestMethod.POST)
- public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds,
- @Valid InputAdmin admin, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- AdminFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (null == admin.getId()) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- if (null == admin.getMobile()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
- return res;
- }
- if (null == admin.getName()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名为空", "用户名"));
- return res;
- }
- Admin aa = adminService.selectByMobile(admin.getMobile().trim());
- if (null != aa && !admin.getId().equals(aa.getId())) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- Admin a = adminService.selectByPrimaryKey(admin.getId());
- if (null == a) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- Admin ad = new Admin();
- BeanUtils.copyProperties(admin, ad);
- List<String> roles = new ArrayList<String>();
- if (roleIds != null && roleIds.length > 0) {
- for (String role : roleIds) {
- roles.add(role);
- }
- }
- res.setData(adminService.updateByPrimaryKeySelective(ad, roles));
- return res;
- }
- /**
- * 重置管理员密码
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/resetPwd", method = RequestMethod.POST)
- public Result resetPwd(String id) {
- Result res = new Result();
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- Admin admin = adminService.selectByPrimaryKey(id);
- if (null == admin) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
- return res;
- }
- Admin a = new Admin();
- a.setId(admin.getId());
- a.setCreateTime(admin.getCreateTime());
- a.setPassword("123456");
- a.setPassword(passwordUtil.getEncryptPwd(a));
- res.setData(adminService.updateByPrimaryKey(a));
- return res;
- }
- /**
- * 新增用户
- *
- * @param mobile
- * @param type
- * @param unitName
- * @return
- */
- @RequestMapping(value = "/addNewUser", method = RequestMethod.POST)
- public Result addNewUser(@Valid InputUser inputUser, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- UserFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(inputUser.getMobile())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "mobile", "mobile"));
- return res;
- }
- if (null == inputUser.getType()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "type", "type"));
- return res;
- }
- User user = userService.selectByMobieAndType(inputUser.getMobile().trim(), inputUser.getType());
- if (null != user) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- User u = new User();
- u.setId(UUID.randomUUID().toString());
- u.setMobile(inputUser.getMobile().trim());
- u.setPassword(inputUser.getMobile().trim());
- u.setType(inputUser.getType());
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- u.setCreateTime(now.getTime());
- u.setPassword(passwordUtil.getEncryptPwd(u));
- u.setLvl(0);
- u.setAid(TokenManager.getAdminId());
- userService.insertRegister(u, "", inputUser.getUnitName());
- return res;
- }
- /**
- * 个人用户列表
- *
- * @param mobile
- * @param email
- * @param createTime
- * @param number
- * @param auditStatus
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/userList", method = RequestMethod.POST)
- public Result userList(String mobile, String email,
- @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getUserList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
- return res;
- }
- /**
- * 个人用户信息明细
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/userDetail", method = RequestMethod.POST)
- public Result userDetail(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(userIdentityService.selectUserIdentityByUserId(uid));
- return res;
- }
- /**
- * 修改个人用户信息
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/updateUserDetail", method = RequestMethod.POST)
- public Result updateUserDetail(@Valid InputUserIdentity userIdentity, BindingResult bindingResult,
- String paymentDateFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (null == userIdentity.getUid()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!StringUtils.isBlank(paymentDateFormattedDate)) {
- try {
- userIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- UserIdentity ui = new UserIdentity();
- BeanUtils.copyProperties(userIdentity, ui);
- if (StringUtils.isBlank(ui.getId())) {
- ui.setId(UUID.randomUUID().toString());
- ui.setAuditStatus(null == ui.getAuditStatus() ? 0 : ui.getAuditStatus());
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.UNCOMMITTED.getCode());
- } else if (IdentityAuditStatus.COMMITTED.getCode() == ui.getAuditStatus()
- || IdentityAuditStatus.UNPAID.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.COMMITTED.getCode());
- } else if (IdentityAuditStatus.PAID.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.FILLIN.getCode());
- } else if (IdentityAuditStatus.NOTPASSED.getCode() == ui.getAuditStatus()
- || IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.RESULTS.getCode());
- }
- res.setData(userIdentityService.insert(ui));
- } else {
- ui.setAuditStatus(null == ui.getAuditStatus() ? 0 : ui.getAuditStatus());
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.UNCOMMITTED.getCode());
- } else if (IdentityAuditStatus.COMMITTED.getCode() == ui.getAuditStatus()
- || IdentityAuditStatus.UNPAID.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.COMMITTED.getCode());
- } else if (IdentityAuditStatus.PAID.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.FILLIN.getCode());
- } else if (IdentityAuditStatus.NOTPASSED.getCode() == ui.getAuditStatus()
- || IdentityAuditStatus.PASSED.getCode() == ui.getAuditStatus()) {
- ui.setProcess(IdentityProcess.RESULTS.getCode());
- }
- res.setData(userIdentityService.updateUserDetail(ui));
- }
- return res;
- }
- /**
- * 团体用户列表
- *
- * @param mobile
- * @param email
- * @param createTime
- * @param number
- * @param auditStatus
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/orgList", method = RequestMethod.POST)
- public Result orgList(String uid, String mobile, String email,
- @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number, String unitName,
- Integer auditStatus, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getOrgList(uid, mobile, email, createTime, number, unitName, auditStatus, pNo, pSize));
- return res;
- }
- /**
- * 团体用户明细
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/orgDetail", method = RequestMethod.POST)
- public Result orgDetail(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(organizationIdentityService.selectOrgIdentityByUserId(uid));
- return res;
- }
- /**
- * 修改团体用户信息
- *
- * @param orgIdentity
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/updateOrgDetail", method = RequestMethod.POST)
- public Result updateOrgDetail(@Valid InputOrganizationIdentity orgIdentity, BindingResult bindingResult,
- String paymentDateFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrganizationIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (null == orgIdentity.getUid()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!StringUtils.isBlank(paymentDateFormattedDate)) {
- try {
- orgIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrganizationIdentity oi = new OrganizationIdentity();
- BeanUtils.copyProperties(orgIdentity, oi);
- if (StringUtils.isBlank(oi.getId())) {
- oi.setId(UUID.randomUUID().toString());
- oi.setIdentityType(null == oi.getIdentityType() ? 0 : oi.getIdentityType());
- oi.setAuditStatus(null == oi.getAuditStatus() ? 0 : oi.getAuditStatus());
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.UNCOMMITTED.getCode());
- } else if (IdentityAuditStatus.COMMITTED.getCode() == oi.getAuditStatus()
- || IdentityAuditStatus.UNPAID.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.COMMITTED.getCode());
- } else if (IdentityAuditStatus.PAID.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.FILLIN.getCode());
- } else if (IdentityAuditStatus.NOTPASSED.getCode() == oi.getAuditStatus()
- || IdentityAuditStatus.PASSED.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.RESULTS.getCode());
- }
- oi.setListed(null == oi.getListed() ? 0 : oi.getListed());
- oi.setListedType(null == oi.getListedType() ? 0 : oi.getListedType());
- res.setData(organizationIdentityService.insert(oi));
- } else {
- oi.setAuditStatus(null == oi.getAuditStatus() ? 0 : oi.getAuditStatus());
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.UNCOMMITTED.getCode());
- } else if (IdentityAuditStatus.COMMITTED.getCode() == oi.getAuditStatus()
- || IdentityAuditStatus.UNPAID.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.COMMITTED.getCode());
- } else if (IdentityAuditStatus.PAID.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.FILLIN.getCode());
- } else if (IdentityAuditStatus.NOTPASSED.getCode() == oi.getAuditStatus()
- || IdentityAuditStatus.PASSED.getCode() == oi.getAuditStatus()) {
- oi.setProcess(IdentityProcess.RESULTS.getCode());
- }
- res.setData(organizationIdentityService.updateOrgDetail(oi));
- }
- return res;
- }
- /**
- * 团体用户人力资源情况列表
- *
- * @param uid
- * 用户ID
- * @return
- */
- @RequestMapping(value = "/orgHumanResource", method = RequestMethod.POST)
- public Result orgHumanResource(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgHumanResourceService.listOrgHumanResource(year, pNo, pSize, uid));
- return res;
- }
- /**
- * 新增及修改团体用户人力资源情况
- *
- * @param orgHumanResource
- * @return
- */
- @RequestMapping(value = "/updateOrgHumanResource", method = RequestMethod.POST)
- public Result updateOrgHumanResource(@Valid InputOrgHumanResource orgHumanResource, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgHumanResourceFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgHumanResource.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == orgHumanResource.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- if (!checkCertify(res, orgHumanResource.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgHumanResource ohr = new OrgHumanResource();
- BeanUtils.copyProperties(orgHumanResource, ohr);
- if (StringUtils.isBlank(ohr.getId())) {
- if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(ohr.getYear(), ohr.getUid())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
- return res;
- }
- ohr.setId(UUID.randomUUID().toString());
- ohr.setDeletedSign(0);
- orgHumanResourceService.insert(ohr);
- } else {
- orgHumanResourceService.updateByPrimaryKeySelective(ohr);
- }
- return res;
- }
- /**
- * 企业花名册上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadRoster", method = RequestMethod.POST)
- public Result uploadRoster(HttpServletRequest req, String sign, String uid, String year) {
- Result res = new Result();
- if (StringUtils.isBlank(year)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
- return res;
- }
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ROSTER) {
- sign = sign + "_" + year;
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业社保情况表上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadSocialSecurity", method = RequestMethod.POST)
- public Result uploadSocialSecurity(HttpServletRequest req, String sign, String uid, String year) {
- Result res = new Result();
- if (StringUtils.isBlank(year)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
- return res;
- }
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
- sign = sign + "_" + year;
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业花名册及社保情况表下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadHumanResource", method = RequestMethod.GET)
- public Result downloadHumanResource(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
- return res;
- }
- OrgHumanResource ohr = orgHumanResourceService.selectByPrimaryKey(id);
- if (ohr == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业人员情况id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ROSTER) {
- downloadFile(response, ohr.getRosterDownloadFileName(), ohr.getRosterUrl());
- } else if (attachmentType == AttachmentType.SOCIAL_SECURITY) {
- downloadFile(response, ohr.getSocialSecurityDownloadFileName(), ohr.getSocialSecurityUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细列表
- *
- * @param uid
- * 用户id
- * @return
- */
- @RequestMapping(value = "/standard", method = RequestMethod.POST)
- public Result standard(String uid, String standardName, String standardNumber, Integer standardLevel,
- Integer participateWay, String pageNo, String pageSize) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgStandardService.listOrgStandard(standardName, standardNumber, standardLevel, participateWay, pNo,
- pSize, uid));
- return res;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细新增及修改
- *
- * @param orgStandard
- * @return
- */
- @RequestMapping(value = "/developStandard", method = RequestMethod.POST)
- public Result developStandard(@Valid InputOrgStandard orgStandard, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgStandardFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgStandard.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == orgStandard.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
- return res;
- }
- if (!checkCertify(res, orgStandard.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgStandard os = new OrgStandard();
- BeanUtils.copyProperties(orgStandard, os);
- if (StringUtils.isBlank(os.getId())) {
- os.setId(UUID.randomUUID().toString());
- os.setDeletedSign(0);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- os.setCreateTime(now.getTime());
- orgStandardService.insert(os);
- } else {
- orgStandardService.updateByPrimaryKeySelective(os);
- }
- res.setData(orgStandard);
- return res;
- }
- /**
- * 上传标准制定附件
- *
- * @param req
- * @param sign
- * @param uid
- * @param year
- * @return
- */
- @RequestMapping(value = "/uploadStandard", method = RequestMethod.POST)
- public Result uploadStandard(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.STANDARD) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 下载标准制定附件
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadStandard", method = RequestMethod.GET)
- public Result downloadStandard(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准制定id"));
- return res;
- }
- OrgStandard os = orgStandardService.selectByPrimaryKey(id);
- if (os == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "标准指定id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.STANDARD) {
- downloadFile(response, os.getStandardDownloadFileName(), os.getEnclosureUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除标准制定情况记录
- *
- * @param id
- * 记录id
- * @return
- */
- @RequestMapping(value = "/deleteStandard", method = RequestMethod.POST)
- public Result deleteStandard(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgStandardService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 知识产权列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/intellectualList", method = RequestMethod.POST)
- public Result intellectualList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgIntellectualPropertyService.listIntellectual(pNo, pSize, uid));
- return res;
- }
- /**
- * 知识产权详情
- *
- * @return
- */
- @RequestMapping(value = "/intellectualDetail", method = RequestMethod.GET)
- public Result intellectualDetail(String id, Integer type) {
- Result res = new Result();
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权ID"));
- return res;
- }
- if (null == type) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
- return res;
- }
- OrgIntellectualProperty oip = orgIntellectualPropertyService.selectByPrimaryKey(id);
- if (null == oip) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
- return res;
- }
- if (IntellectualPropertyType.PATENT.getCode() == type) {
- res.setData(orgIntellectualPropertyService.selectPatentTypeDetail(id));
- } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
- res.setData(orgIntellectualPropertyService.selectCopyrightTypeDetail(id));
- } else if (IntellectualPropertyType.COMMON.getCode() == type) {
- OrgIntellectualPropertyDetailBo oipdb = new OrgIntellectualPropertyDetailBo();
- BeanUtils.copyProperties(oip, oipdb);
- res.setData(oipdb);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
- }
- return res;
- }
- /**
- * 知识产权信息新增及修改
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/intellectual", method = RequestMethod.POST)
- public Result intellectual(@Valid InputOrgIntellectualProperty orgIntellectualProperty, BindingResult bindingResult,
- String authorizationDateFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgIntellectualPropertyFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgIntellectualProperty.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, orgIntellectualProperty.getUid()).getError().isEmpty()) {
- return res;
- }
- if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
- try {
- orgIntellectualProperty.setAuthorizationDate(
- DateUtils.parseDate(authorizationDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrgIntellectualProperty oip = new OrgIntellectualProperty();
- BeanUtils.copyProperties(orgIntellectualProperty, oip);
- if (StringUtils.isBlank(oip.getId())) {
- oip.setId(UUID.randomUUID().toString());
- oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 1 : 0);
- oip.setDeletedSign(0);
- oip.setType(IntellectualPropertyType.COMMON.getCode());
- res.setData(orgIntellectualPropertyService.insert(oip));
- } else {
- oip.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
- res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(oip));
- }
- return res;
- }
- /**
- * 知识产权证书上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadPropertyRight", method = RequestMethod.POST)
- public Result uploadPropertyRight(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 知识产权证书下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadPropertyRight", method = RequestMethod.GET)
- public Result downloadPropertyRight(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
- return res;
- }
- OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
- if (olp == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROPERTY_RIGHT) {
- downloadFile(response, olp.getPropertyRightDownloadFileName(), olp.getPropertyRightUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 知识产权稿件下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadManuscript", method = RequestMethod.GET)
- public Result downloadManuscript(HttpServletResponse response, String sign, String id, Integer type) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权id"));
- return res;
- }
- if (null == type) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "知识产权TYPE"));
- return res;
- }
- OrgIntellectualProperty olp = orgIntellectualPropertyService.selectByPrimaryKey(id);
- if (olp == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID"));
- return res;
- }
- String fileName = null;
- String downloadUrl = null;
- if (IntellectualPropertyType.PATENT.getCode() == type) {
- PatentInfo pi = patentInfoService.selectByPrimaryKey(olp.getPid());
- if (null == pi) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
- return res;
- }
- fileName = pi.getPatentWritingDownloadFileName();
- downloadUrl = pi.getPatentWritingUrl();
- } else if (IntellectualPropertyType.COPYRIGHT.getCode() == type) {
- CopyrightInfoDetail ci = copyrightInfoService.findByPrimaryKey(olp.getPid());
- if (null == ci) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权ID及TYPE"));
- return res;
- }
- fileName = ci.getApplicationUrlDownloadFileName();
- downloadUrl = ci.getApplicationUrl();
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.MANUSCRIPT) {
- downloadFile(response, fileName, downloadUrl);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除知识产权记录
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/deleteIntellectual", method = RequestMethod.POST)
- public Result deleteIntellectual(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgIntellectualPropertyService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 上年度高新技术产品(服务)情况列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/techProductList", method = RequestMethod.POST)
- public Result techProductList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgTechProductService.listTechProduct(pNo, pSize, uid));
- return res;
- }
- /**
- * 上年度高新技术产品(服务)情况(新增+修改)
- *
- * @param orgTechProduct
- * @return
- */
- @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
- public Result techProduct(@Valid InputOrgTechProduct orgTechProduct, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgTechProductFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgTechProduct.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, orgTechProduct.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgTechProduct otp = new OrgTechProduct();
- BeanUtils.copyProperties(orgTechProduct, otp);
- if (StringUtils.isBlank(otp.getId())) {
- otp.setId(UUID.randomUUID().toString());
- otp.setDeletedSign(0);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- otp.setCreateTime(now.getTime());
- otp.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
- orgTechProductService.insert(otp);
- } else {
- orgTechProductService.updateByPrimaryKeySelective(otp);
- }
- res.setData(orgTechProduct);
- return res;
- }
- /**
- * 高新技术产品台帐上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadTecProduct", method = RequestMethod.POST)
- public Result uploadTecProduct(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.TECH_PRODUCT) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 高新技术产品台帐下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadTecProduct", method = RequestMethod.GET)
- public Result downloadTecProduct(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
- return res;
- }
- OrgTechProduct otp = orgTechProductService.selectByPrimaryKey(id);
- if (otp == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高新技术产品id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.TECH_PRODUCT) {
- downloadFile(response, otp.getAccountDownloadFileName(), otp.getAccountUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除上年度高新技术产品(服务)情况记录
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteTechProduct", method = RequestMethod.POST)
- public Result deleteTechProduct(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgTechProductService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 企业研究开发活动情况表入口
- *
- * @param activityNumber
- * @param activityName
- * @param startDate
- * @param endDate
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityList", method = RequestMethod.POST)
- public Result activityList(String activityNumber, String activityName, String startDateFormattedDate,
- String endDateFormattedDate, String pageNo, String pageSize, String uid) throws ParseException {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgActivityService.listOrgActivity(activityNumber, activityName, startDateFormattedDate,
- endDateFormattedDate, pNo, pSize, uid));
- return res;
- }
- /**
- * 企业研究开发活动情况新增、修改
- *
- * @param orgActivity
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activity", method = RequestMethod.POST)
- public Result activity(@Valid InputOrgActivity orgActivity, BindingResult bindingResult,
- String startDateFormattedDate, String endDateFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgActivity.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, orgActivity.getUid()).getError().isEmpty()) {
- return res;
- }
- if (!StringUtils.isBlank(startDateFormattedDate)) {
- try {
- orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- if (StringUtils.isBlank(endDateFormattedDate)) {
- try {
- orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrgActivity oa = new OrgActivity();
- BeanUtils.copyProperties(orgActivity, oa);
- oa.setDeletedSign(0);
- if (StringUtils.isBlank(oa.getId())) {
- oa.setId(UUID.randomUUID().toString());
- orgActivityService.insert(oa);
- } else {
- orgActivityService.updateOrgActivity(oa);
- }
- res.setData(orgActivity);
- return res;
- }
- /**
- * 研发活动立项证明材料上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadProof", method = RequestMethod.POST)
- public Result uploadProof(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROOF) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 研发活动立项证明材料下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadProof", method = RequestMethod.GET)
- public Result downloadProof(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
- return res;
- }
- OrgActivity oa = orgActivityService.selectOrgActivityByPrimaryKey(id);
- if (oa == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROOF) {
- downloadFile(response, oa.getProofDownloadFileName(), oa.getProofUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除企业研究开发活动情况
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteActivity", method = RequestMethod.POST)
- public Result deleteActivity(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgActivityService.deleteByPrimaryKey(Arrays.asList(ids)));
- orgActivityCostService.deleteByAid(Arrays.asList(ids));
- }
- return res;
- }
- /**
- * 企业年度研究开发费用结构明细表列表
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityCostList", method = RequestMethod.POST)
- public Result activityCostList(String activityNumber, String startDateFormattedDate, String endDateFormattedDate,
- String pageNo, String pageSize, String uid, Integer year) throws ParseException {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgActivityCostService.listOrgActivityCost(activityNumber, startDateFormattedDate,
- endDateFormattedDate, pNo, pSize, uid, year));
- return res;
- }
- /**
- * 企业年度研究开发费用结构明细表(新增+修改)
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityCost", method = RequestMethod.POST)
- public Result activityCost(@Valid InputOrgActivityCost orgActivityCost, BindingResult bindingResult,
- String signDateFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgActivityCost.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (StringUtils.isBlank(orgActivityCost.getAid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到研发活动", "研发活动ID"));
- return res;
- }
- if (null == orgActivityCost.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- if (!checkCertify(res, orgActivityCost.getUid()).getError().isEmpty()) {
- return res;
- }
- if (StringUtils.isBlank(signDateFormattedDate)) {
- try {
- orgActivityCost.setSignDate(DateUtils.parseDate(signDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业填报人签字日期"));
- return res;
- }
- }
- OrgActivityCost oac = new OrgActivityCost();
- BeanUtils.copyProperties(orgActivityCost, oac);
- if (StringUtils.isBlank(oac.getId())) {
- if (null != orgActivityCostService.selectOrgActivityCostByAidAndYear(oac.getAid(), oac.getYear())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目当前年份费用详情已录入!"));
- return res;
- }
- OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(oac.getAid());
- if (null != ac) {
- Calendar c = Calendar.getInstance();
- c.setTime(ac.getStartDate());
- Integer s = c.get(Calendar.YEAR);
- c.setTime(ac.getEndDate());
- Integer e = c.get(Calendar.YEAR);
- if (oac.getYear() < s || oac.getYear() > e) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
- return res;
- }
- oac.setStartDate(null == ac.getStartDate() ? null : ac.getStartDate());
- oac.setEndDate(null == ac.getEndDate() ? null : ac.getEndDate());
- oac.setId(UUID.randomUUID().toString());
- oac.setDeletedSign(0);
- orgActivityCostService.insert(oac);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到研发活动", "研发活动ID"));
- return res;
- }
- } else {
- orgActivityCostService.updateByPrimaryKeySelective(oac);
- }
- return res;
- }
- /**
- * 研发活动费用台帐上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadActivityCost", method = RequestMethod.POST)
- public Result uploadActivityCost(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 研发活动费用台帐下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadActivityCost", method = RequestMethod.GET)
- public Result downloadActivityCost(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
- return res;
- }
- OrgActivityCost oac = orgActivityCostService.selectByPrimaryKey(id);
- if (oac == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", " 研发活动费用id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACTIVITY_COST_ACCOUNT) {
- downloadFile(response, oac.getAccountDownloadFileName(), oac.getAccountUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除企业年度研究开发费用结构明细记录
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteActivityCost", method = RequestMethod.POST)
- public Result deleteActivityCost(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgActivityCostService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 获取当前用户已录入项目标号列表
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/activityNumber", method = RequestMethod.POST)
- public Result listActivityNumber(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- List<ActivityNumberBo> activityNumberBo = orgActivityService.selectOrgActivityNumberBoByUid(uid);
- res.setData(activityNumberBo);
- return res;
- }
- /**
- * 企业纳税申报信息列表
- *
- * @return
- */
- @RequestMapping(value = "/ratepay", method = RequestMethod.POST)
- public Result ratepay(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, uid));
- return res;
- }
- /**
- * 企业纳税信息详情(获取同年度财务报表重复数据)
- *
- * @param uid
- * @param year
- * @return
- */
- @RequestMapping(value = "/ratepayDetail", method = RequestMethod.GET)
- public Result ratepayDetail(String uid, Integer year) {
- Result res = new Result();
- if (null == uid) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == year) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- OrgFinance of = orgFinanceService.selectFinanceByUidAndYear(uid, year);
- if (null != of) {
- Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
- map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), of.getGrossProfit());
- map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), of.getManagementCost());
- map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), of.getOperatingProfit());
- map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), of.getResearchCost());
- res.setData(map);
- }
- return res;
- }
- /**
- * 企业纳税申报信息录入+修改
- */
- @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
- public Result disposeRatepay(@Valid InputOrgRatepay orgRatepay, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgRatepayFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgRatepay.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == orgRatepay.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- if (!checkCertify(res, orgRatepay.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgRatepay rate = new OrgRatepay();
- BeanUtils.copyProperties(orgRatepay, rate);
- if (StringUtils.isBlank(rate.getId())) {
- if (null == orgRatepayService.selectRatepayByUidAndYear(rate.getUid(), rate.getYear())) {
- rate.setId(UUID.randomUUID().toString());
- rate.setDeletedSign(0);
- orgRatepayService.insert(rate);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
- return res;
- }
- } else {
- orgRatepayService.updateByPrimaryKeySelective(rate);
- }
- return res;
- }
- /**
- * 企业纳税申报表上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadRatepay", method = RequestMethod.POST)
- public Result uploadRatepay(HttpServletRequest req, String sign, String uid, String year) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- if (StringUtils.isBlank(year)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.RATEPAY) {
- sign = sign + "_" + year;
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业纳税申报表下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadRatepay", method = RequestMethod.GET)
- public Result downloadRatepay(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
- return res;
- }
- OrgRatepay ratepay = orgRatepayService.selectByPrimaryKey(id);
- if (ratepay == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业纳税申报id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.RATEPAY) {
- downloadFile(response, ratepay.getTaxReturnDownloadFileName(), ratepay.getTaxReturnUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 刪除企业纳税申报信息
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteRatepay", method = RequestMethod.POST)
- public Result deleteRatepay(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgRatepayService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 财务报表信息列表
- *
- * @return
- */
- @RequestMapping(value = "/finance", method = RequestMethod.POST)
- public Result finance(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgFinanceService.listFinance(year, pNo, pSize, uid));
- return res;
- }
- /**
- * 财务报表详情(获取同年度纳税申报表重复数据)
- *
- * @return
- */
- @RequestMapping(value = "/financeDetail", method = RequestMethod.GET)
- public Result financeDetail(String uid, Integer year) {
- Result res = new Result();
- if (null == uid) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == year) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- OrgRatepay ratepay = orgRatepayService.selectRatepayByUidAndYear(uid, year);
- if (null != ratepay) {
- Map<String, BigDecimal> map = new HashMap<String, BigDecimal>();
- map.put(FinanceRatepayFields.GROSSPROFIT.getCode(), ratepay.getGrossProfit());
- map.put(FinanceRatepayFields.MANAGEMENTCOST.getCode(), ratepay.getManagementCost());
- map.put(FinanceRatepayFields.OPERATINGPROFIT.getCode(), ratepay.getOperatingProfit());
- map.put(FinanceRatepayFields.RESEARCHCOST.getCode(), ratepay.getResearchCost());
- res.setData(map);
- }
- return res;
- }
- /**
- * 财务报表录入+修改
- *
- * @param orgFinance
- * @return
- */
- @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
- public Result disposeFinance(@Valid InputOrgFinance orgFinance, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgFinanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgFinance.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == orgFinance.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- if (!checkCertify(res, orgFinance.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgFinance of = new OrgFinance();
- BeanUtils.copyProperties(orgFinance, of);
- if (StringUtils.isBlank(of.getId())) {
- if (null == orgFinanceService.selectFinanceByUidAndYear(of.getUid(), of.getYear())) {
- of.setId(UUID.randomUUID().toString());
- of.setDeletedSign(0);
- orgFinanceService.insert(of);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
- return res;
- }
- } else {
- orgFinanceService.updateByPrimaryKeySelective(of);
- }
- return res;
- }
- /**
- * 企业财务报表上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadFinance", method = RequestMethod.POST)
- public Result uploadFinance(HttpServletRequest req, String sign, String uid, String year) {
- Result res = new Result();
- if (StringUtils.isBlank(year)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示年份"));
- return res;
- }
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.FINANCE) {
- sign = sign + "_" + year;
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 企业财务报表下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadFinance", method = RequestMethod.GET)
- public Result downloadFinance(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
- return res;
- }
- OrgFinance of = orgFinanceService.selectByPrimaryKey(id);
- if (of == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "企业财务报表id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.FINANCE) {
- downloadFile(response, of.getFinanceDownloadFileName(), of.getFinanceUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除财务报表
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteFinance", method = RequestMethod.POST)
- public Result deleteFinance(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgFinanceService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 科技成果转化情况列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/achievementList", method = RequestMethod.POST)
- public Result achievementList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, uid));
- return res;
- }
- /**
- * 科技成果转化情况新增+修改
- *
- * @param achievement
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
- public Result disposeAchievement(@Valid InputOrgTechAchievement achievement, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgTechAchievementFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(achievement.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, achievement.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgTechAchievement ota = new OrgTechAchievement();
- BeanUtils.copyProperties(achievement, ota);
- if (StringUtils.isBlank(ota.getId())) {
- ota.setId(UUID.randomUUID().toString());
- ota.setDeletedSign(0);
- orgTechAchievementService.insert(ota);
- } else {
- orgTechAchievementService.updateByPrimaryKeySelective(ota);
- }
- return res;
- }
- /**
- * 科技成果附件上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadAchievement", method = RequestMethod.POST)
- public Result uploadAchievement(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACHIEVEMENT) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 科技成果附件下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadAchievement", method = RequestMethod.GET)
- public Result downloadAchievement(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
- return res;
- }
- OrgTechAchievement ota = orgTechAchievementService.selectByPrimaryKey(id);
- if (ota == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "科技成果id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.ACHIEVEMENT) {
- downloadFile(response, ota.getEnclosureDownloadFileName(), ota.getEnclosureUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除科技成果转化情况
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteAchievement", method = RequestMethod.POST)
- public Result deleteAchievement(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgTechAchievementService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 企业荣誉及其他证明材料列表
- *
- * @return
- */
- @RequestMapping(value = "/honorList", method = RequestMethod.POST)
- public Result honorList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, uid));
- return res;
- }
- /**
- * 企业荣誉及其他证明材料新增+修改
- *
- * @param achievement
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
- public Result disposeHonor(@Valid InputOrgHonorDatum honor, BindingResult bindingResult,
- String issuingTimeFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgHonorDatumFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(honor.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == honor.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
- return res;
- }
- if (!checkCertify(res, honor.getUid()).getError().isEmpty()) {
- return res;
- }
- if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
- try {
- honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrgHonorDatum ohd = new OrgHonorDatum();
- BeanUtils.copyProperties(honor, ohd);
- if (StringUtils.isBlank(ohd.getId())) {
- ohd.setId(UUID.randomUUID().toString());
- ohd.setDeletedSign(0);
- orgHonorDatumService.insert(ohd);
- } else {
- orgHonorDatumService.updateByPrimaryKeySelective(ohd);
- }
- return res;
- }
- /**
- * 荣誉及其他证明材料上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadHonor", method = RequestMethod.POST)
- public Result uploadHonor(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.HONOR) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 荣誉及其他证明材料下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadHonor", method = RequestMethod.GET)
- public Result downloadHonor(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
- return res;
- }
- OrgHonorDatum ohd = orgHonorDatumService.selectByPrimaryKey(id);
- if (ohd == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "荣誉及其他证明材料id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.HONOR) {
- downloadFile(response, ohd.getEnclosureDownloadFileName(), ohd.getEnclosureUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除企业荣誉及其他证明材料
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteHonor", method = RequestMethod.POST)
- public Result deleteHonor(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgHonorDatumService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 技术中心入口
- *
- * @return
- */
- @RequestMapping(value = "/center", method = RequestMethod.POST)
- public Result center(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- res.setData(orgTechCenterService.selectOrgTechCenterByUid(uid));
- return res;
- }
- /**
- * 技术中心新增+修改
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
- public Result disposeCenter(@Valid InputOrgTechCenter orgTechCenter, BindingResult bindingResult,
- String foundingTimeFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgTechCenterFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgTechCenter.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, orgTechCenter.getUid()).getError().isEmpty()) {
- return res;
- }
- if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
- try {
- orgTechCenter.setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrgTechCenter otc = new OrgTechCenter();
- BeanUtils.copyProperties(orgTechCenter, otc);
- if (StringUtils.isBlank(otc.getId())) {
- otc.setId(UUID.randomUUID().toString());
- otc.setDeletedSign(0);
- orgTechCenterService.insert(otc);
- } else {
- orgTechCenterService.updateByPrimaryKeySelective(otc);
- }
- return res;
- }
- /**
- * 研发部门制度上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadInstitution", method = RequestMethod.POST)
- public Result uploadInstitution(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.INSTITUTION) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 研发部门制度下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadInstitution", method = RequestMethod.GET)
- public Result downloadInstitution(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
- return res;
- }
- OrgTechCenter otc = orgTechCenterService.selectByPrimaryKey(id);
- if (otc == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发部门id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.INSTITUTION) {
- downloadFile(response, otc.getSystemDownloadFileName(), otc.getSystemUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 产学研情况列表
- *
- * @return
- */
- @RequestMapping(value = "/centerDetail", method = RequestMethod.GET)
- public Result centerDetail(String pageNo, String pageSize, String cid) {
- Result res = new Result();
- if (StringUtils.isBlank(cid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "技术中心ID"));
- return res;
- }
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgTechCenterDetailService.listOrgTechCenterDetail(pNo, pSize, cid));
- return res;
- }
- /**
- * 产学研情况新增+修改
- *
- * @param orgTechCenterDetail
- * @param projectTimeFormattedDate
- * @param termTimeFormattedDate
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeCenterDetail", method = RequestMethod.POST)
- public Result disposeCenterDetail(@Valid InputOrgTechCenterDetail orgTechCenterDetail, BindingResult bindingResult,
- String projectTimeFormattedDate, String termStartTimeFormattedDate, String termEndTimeFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgTechCenterDetailFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (!StringUtils.isBlank(projectTimeFormattedDate)) {
- try {
- orgTechCenterDetail
- .setProjectTime(DateUtils.parseDate(projectTimeFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- if (!StringUtils.isBlank(termStartTimeFormattedDate)) {
- try {
- orgTechCenterDetail
- .setTermStartTime(DateUtils.parseDate(termStartTimeFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- if (!StringUtils.isBlank(termEndTimeFormattedDate)) {
- try {
- orgTechCenterDetail
- .setTermEndTime(DateUtils.parseDate(termEndTimeFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- }
- OrgTechCenterDetail otcd = new OrgTechCenterDetail();
- BeanUtils.copyProperties(orgTechCenterDetail, otcd);
- if (StringUtils.isBlank(otcd.getId())) {
- otcd.setId(UUID.randomUUID().toString());
- otcd.setDeletedSign(0);
- orgTechCenterDetailService.insert(otcd);
- } else {
- orgTechCenterDetailService.updateByPrimaryKeySelective(otcd);
- }
- return res;
- }
- /**
- * 产学研技术中心协议上传
- *
- * @param req
- * @param sign
- * @param uid
- * @return
- */
- @RequestMapping(value = "/uploadProtocol", method = RequestMethod.POST)
- public Result uploadProtocol(HttpServletRequest req, String sign, String uid) {
- Result res = new Result();
- if (null == uid) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
- return res;
- }
- User curUser = userService.selectByPrimaryKey(uid);
- if (!checkCertify(res, curUser)) {
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROTOCOL) {
- res.setData(handleFiles(res, "/cognizance/", true, req, sign, uid));
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 产学研技术中心协议下载
- *
- * @param response
- * @param sign
- * @param id
- * @return
- */
- @RequestMapping(value = "/downloadProtocol", method = RequestMethod.GET)
- public Result downloadProtocol(HttpServletResponse response, String sign, String id) {
- Result res = new Result();
- if (StringUtils.isEmpty(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
- return res;
- }
- OrgTechCenterDetail otcd = orgTechCenterDetailService.selectByPrimaryKey(id);
- if (otcd == null) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "产学研技术中心id"));
- return res;
- }
- AttachmentType attachmentType = AttachmentType.getField(sign);
- if (attachmentType == AttachmentType.PROTOCOL) {
- downloadFile(response, otcd.getProtocolDownloadFileName(), otcd.getProtocolUrl());
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
- }
- return res;
- }
- /**
- * 删除技术中心明细
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteOrgTechCenterDetail", method = RequestMethod.POST)
- public Result deleteOrgTechCenterDetail(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgTechCenterDetailService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 获取公司联系人
- *
- * @return
- */
- @RequestMapping(value = "/getContacts", method = RequestMethod.GET)
- public Result getContacts(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(organizationIdentityService.selectContactsByUserId(uid));
- return res;
- }
- /**
- * 获取公司
- */
- @RequestMapping(value = "/getUnitNames", method = RequestMethod.GET)
- public Result getUnitNames() {
- Result res = new Result();
- List<OrganizationIdentity> list = organizationIdentityService.selectAllOrgIndentity();
- Map<String, String> map = new TreeMap<String, String>();
- for (OrganizationIdentity o : list) {
- map.put(o.getUid(), o.getUnitName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 高企认定列表
- *
- * @param locationProvince
- * @param unitName
- * @return
- */
- @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
- public Result listCognizance(String uid, String unitName, String locationProvince, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgCognizanceService.listCognizance(uid, unitName, locationProvince, pNo, pSize));
- return res;
- }
- /**
- * 高企认定咨询师下拉列表
- *
- * @return
- */
- @RequestMapping(value = "/getConsultant", method = RequestMethod.GET)
- public Result getConsultant() {
- Result res = new Result();
- List<Admin> list = adminService.selectCognizanceConsultant();
- Map<String, String> map = new TreeMap<String, String>();
- for (Admin o : list) {
- map.put(o.getId(), o.getName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 高企负责人下拉
- *
- * @return
- */
- @RequestMapping(value = "/getPrincipal", method = RequestMethod.GET)
- public Result getPrincipal() {
- Result res = new Result();
- List<Admin> list = adminService.selectCognizancePrincipal();
- Map<String, String> map = new TreeMap<String, String>();
- for (Admin o : list) {
- map.put(o.getId(), o.getName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 申请高企认定
- *
- * @return
- */
- @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
- public Result applyCognizance(@Valid InputApplyCognizance cog, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- CognizanceApplyFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(cog.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == cog.getYear()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
- return res;
- }
- if (!checkCertify(res, cog.getUid()).getError().isEmpty()) {
- return res;
- }
- LatelyCogRecord lcr = orgCognizanceService.selectLatelyRecord(cog.getUid());
- if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() != lcr.getState()
- && OrgCognizanceStatus.FOSTER.getCode() != lcr.getState()
- && OrgCognizanceStatus.CALLBACK.getCode() != lcr.getState()) {
- res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
- return res;
- }
- if (null != lcr && null != lcr.getState() && OrgCognizanceStatus.SETTLEMENT.getCode() == lcr.getState()) {
- if (null == lcr.getIssuingDate()) {
- res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企申请中!无法提交新申请!"));
- return res;
- }
- try {
- if (Boolean.FALSE == TimeUtils.checkCogExpire(lcr.getIssuingDate())) {
- res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "", "高企认定未过期,无法提交新申请!"));
- return res;
- }
- } catch (ParseException e) {
- }
- }
- OrgCognizance oc = new OrgCognizance();
- BeanUtils.copyProperties(cog, oc);
- orgCognizanceService.insertCognizance(oc, TokenManager.getAdminId());
- return res;
- }
- /**
- * 高企认定详情入口
- *
- * @param uid
- * @param cid
- * @return
- */
- @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
- public Result cognizanceDetail(String uid, String cid, Integer year) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (StringUtils.isBlank(cid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
- return res;
- }
- if (null == year) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- res.setData(handleCognizanceDetail(uid, cid, year));
- return res;
- }
- /**
- * 高企认定流转状态下拉
- *
- * @return
- */
- @RequestMapping(value = "/cognizanceStatus", method = RequestMethod.GET)
- public Result cognizanceStatus() {
- Result res = new Result();
- res.setData(disposeCognizanceStatus());
- return res;
- }
- /**
- * 高企认定流转状态
- *
- * @param cid
- * @return
- */
- @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
- public Result cognizanceLog(String cid) {
- Result res = new Result();
- if (StringUtils.isBlank(cid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "高企ID"));
- return res;
- }
- res.setData(orgCognizanceLogService.selectOrgCognizanceLogByCid(cid));
- return res;
- }
- /**
- * 保存高企认定详情
- *
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
- public Result disposeCognizanceDetail(@Valid InputOrgCognizance cog, BindingResult bindingResult,
- String recordTimeFormattedDate) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgCognizanceFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(cog.getId())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
- return res;
- }
- OrgCognizance o = orgCognizanceService.selectByPrimaryKey(cog.getId());
- if (null == o) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到", "高企认定"));
- return res;
- }
- if (OrgCognizanceStatus.CALLBACK.getCode() == o.getState()) {
- res.getError().add(buildError(ErrorConstants.RECORD_CALLBACK, "当前记录已退单,无法修改!"));
- return res;
- }
- if (OrgCognizanceStatus.SETTLEMENT.getCode() == o.getState()) {
- res.getError().add(buildError(ErrorConstants.RECORD_SETTLEMENT, "当前记录已结款,无法修改!"));
- return res;
- }
- if (!checkCertify(res, cog.getUid()).getError().isEmpty()) {
- return res;
- }
- Date recordTime = null;
- if (!StringUtils.isBlank(recordTimeFormattedDate)) {
- try {
- recordTime = DateUtils.parseDate(recordTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
- } catch (ParseException e) {
- }
- }
- OrgCognizance oc = new OrgCognizance();
- OrgCognizanceLog ocl = new OrgCognizanceLog();
- BeanUtils.copyProperties(cog, oc);
- BeanUtils.copyProperties(cog, ocl);
- orgCognizanceService.updateCognizance(oc, ocl, recordTime, TokenManager.getAdminId());
- return res;
- }
- /**
- * 刪除高企认定
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteCognizance", method = RequestMethod.POST)
- public Result deleteCognizance(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgCognizanceService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 企业创新能力入口
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/able", method = RequestMethod.POST)
- public Result able(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(userAbilityService.selectUserAbilityByUserId(uid));
- return res;
- }
- /**
- * 企业创新能力新增+保存
- *
- * @param u
- * @return
- */
- @RequestMapping(value = "/disposeAble", method = RequestMethod.POST)
- public Result disposeAble(@Valid InputUserAbility u, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- UserAbilityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(u.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- UserAbility user = new UserAbility();
- BeanUtils.copyProperties(u, user);
- if (StringUtils.isBlank(user.getId())) {
- user.setId(UUID.randomUUID().toString());
- userAbilityService.insert(user);
- } else {
- userAbilityService.updateByPrimaryKeySelective(user);
- }
- return res;
- }
- /**
- * 年报列表
- *
- * @return
- */
- @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
- public Result annualReport(String uid, Integer year, Integer state, String pageSize, String pageNo) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业年报详情
- *
- * @param uid
- * @param year
- * @return
- */
- @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
- public Result annualReportDetail(String uid, Integer year) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (null == year) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "年份"));
- return res;
- }
- if (!checkCertify(res, uid).getError().isEmpty()) {
- return res;
- }
- res.setData(handleAnnualReport(uid, year));
- return res;
- }
- /**
- * 高企年报新增+修改
- *
- * @param orgAnnualReport
- * @return
- */
- @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
- public Result disposeAnnualReport(@Valid InputOrgAnnualReport orgAnnualReport, BindingResult bindingResult) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrgAnnualReportFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgAnnualReport.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (!checkCertify(res, orgAnnualReport.getUid()).getError().isEmpty()) {
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
- return res;
- }
- OrgAnnualReport oar = new OrgAnnualReport();
- BeanUtils.copyProperties(orgAnnualReport, oar);
- if (StringUtils.isBlank(oar.getId())) {
- if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(oar.getYear(), oar.getUid())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
- return res;
- } else {
- oar.setId(UUID.randomUUID().toString());
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- oar.setCreateTime(now.getTime());
- oar.setLastUpdateTime(oar.getCreateTime());
- oar.setDeletedSign(0);
- orgAnnualReportService.insert(oar);
- }
- } else {
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- oar.setLastUpdateTime(now.getTime());
- orgAnnualReportService.updateByPrimaryKeySelective(oar);
- }
- return res;
- }
- /**
- * 删除企业年报记录
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteAnnualReport", method = RequestMethod.POST)
- public Result deleteAnnualReport(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(orgAnnualReportService.deleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- /**
- * 高企培育列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/cultivate", method = RequestMethod.POST)
- public Result cultivationList(String uid, String province, String unitName, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgCognizanceService.listCultivation(uid, province, unitName, pNo, pSize));
- return res;
- }
- // 判断用户是否通过认证
- private Result checkCertify(Result res, String uid) {
- OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(uid);
- if (null == o || 5 != o.getAuditStatus()) {
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
- }
- return res;
- }
- // org团体列表
- private Pagination<OrgListBo> getOrgList(String uid, String mobile, String email, String[] createTime,
- Integer number, String unitName, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
- return userService.listOrg(uid, mobile, email, createTime, number, unitName, auditStatus, pNo, pSize);
- }
- // user个人列表
- private Pagination<UserListBo> getUserList(String mobile, String email, String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
- return userService.listUser(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
- }
- // 高企详情
- private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
- return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
- }
- // 年报
- private AnnualReportBo handleAnnualReport(String uid, Integer year) {
- return orgAnnualReportService.selectAnnualReportBo(uid, year);
- }
- private Map<String, String> disposeCognizanceStatus() {
- Map<String, String> status = new TreeMap<String, String>();
- if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
- for (OrgCognizanceStatus p : OrgCognizanceStatus.values()) {
- status.put(p.getCode().toString(), p.getDesc());
- status.remove(OrgCognizanceStatus.OTHER.getCode().toString());
- }
- } else {
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CREATE.getCode())) {
- status.put(OrgCognizanceStatus.CREATE.getCode().toString(), OrgCognizanceStatus.CREATE.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SIGN.getCode())) {
- status.put(OrgCognizanceStatus.SIGN.getCode().toString(), OrgCognizanceStatus.SIGN.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.DELIVERD.getCode())) {
- status.put(OrgCognizanceStatus.DELIVERD.getCode().toString(), OrgCognizanceStatus.DELIVERD.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CIRCULATION.getCode())) {
- status.put(OrgCognizanceStatus.CIRCULATION.getCode().toString(),
- OrgCognizanceStatus.CIRCULATION.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.PREPARE.getCode())) {
- status.put(OrgCognizanceStatus.PREPARE.getCode().toString(), OrgCognizanceStatus.PREPARE.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SUBMIT.getCode())) {
- status.put(OrgCognizanceStatus.SUBMIT.getCode().toString(), OrgCognizanceStatus.SUBMIT.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.ACCEPT.getCode())) {
- status.put(OrgCognizanceStatus.ACCEPT.getCode().toString(), OrgCognizanceStatus.ACCEPT.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.APPRVOVED.getCode())) {
- status.put(OrgCognizanceStatus.APPRVOVED.getCode().toString(), OrgCognizanceStatus.APPRVOVED.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.REJECT.getCode())) {
- status.put(OrgCognizanceStatus.REJECT.getCode().toString(), OrgCognizanceStatus.REJECT.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.ISSUING.getCode())) {
- status.put(OrgCognizanceStatus.ISSUING.getCode().toString(), OrgCognizanceStatus.ISSUING.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.EXPIRED.getCode())) {
- status.put(OrgCognizanceStatus.EXPIRED.getCode().toString(), OrgCognizanceStatus.EXPIRED.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.FOSTER.getCode())) {
- status.put(OrgCognizanceStatus.FOSTER.getCode().toString(), OrgCognizanceStatus.FOSTER.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.SETTLEMENT.getCode())) {
- status.put(OrgCognizanceStatus.SETTLEMENT.getCode().toString(),
- OrgCognizanceStatus.SETTLEMENT.getDesc());
- }
- if (TokenManager.hasPermission("CognizanceStatus" + OrgCognizanceStatus.CALLBACK.getCode())) {
- status.put(OrgCognizanceStatus.CALLBACK.getCode().toString(), OrgCognizanceStatus.CALLBACK.getDesc());
- }
- }
- return status;
- }
- private OrgCognizanceProportion disposeProportionStatus(String sign, Integer status, OrgCognizanceProportion ocp) {
- if (ProprotionFields.INSTITUTION.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setInstitution(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setInstitution(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.ACTIVITY.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setActivity(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setActivity(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.ACTIVITYCOST.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setActivityCost(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setActivityCost(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.TECHPROJECT.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setTechProject(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setTechProject(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.INTELLECTUALPROPERTY.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setIntellectualProperty(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setIntellectualProperty(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.ACHIEVEMENT.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setAchievement(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setAchievement(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.RATEPAY.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setRatepay(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setRatepay(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.FINANCE.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setFinance(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setFinance(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.HUMANRESOURCE.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setHumanResource(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setHumanResource(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.HONORDATUM.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setHonorDatum(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setHonorDatum(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.STANDARD.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setStandard(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setStandard(ProportionStatus.UNFINISHED.getCode());
- }
- } else if (ProprotionFields.ABILITY.getCode().equals(sign)) {
- if (ProportionStatus.FINISHED.getCode() == status) {
- ocp.setAbility(ProportionStatus.FINISHED.getCode());
- } else {
- ocp.setAbility(ProportionStatus.UNFINISHED.getCode());
- }
- }
- return ocp;
- }
- /*
- * @Test public void test () throws IllegalArgumentException,
- * IllegalAccessException{ Admin a = new Admin(); import
- * java.lang.reflect.Field; boolean flag = Boolean.FALSE; for(Field f :
- * a.getClass().getDeclaredFields()){ f.setAccessible(true); if(f.get(a) ==
- * null){ flag = true; } } }
- */
- }
|