| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066 |
- package com.goafanti.admin.controller;
- import java.math.BigDecimal;
- import java.text.ParseException;
- 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.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.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.CertifySubmitType;
- import com.goafanti.common.enums.CognizanceApplyFields;
- import com.goafanti.common.enums.DeleteStatus;
- 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.enums.UserLevel;
- import com.goafanti.common.enums.UserType;
- 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.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.OrgUnitNames;
- 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;
- /**
- * 获取营销员及营销经理下拉
- */
- @RequestMapping(value = "/salesman", method = RequestMethod.GET)
- public Result getSalesMan() {
- Result res = new Result();
- res.setData(adminService.selectSalesman());
- return res;
- }
- /**
- * 统计专利、软著及科技项目申报业务情况
- */
- @RequestMapping(value = "/getBusinessCount", method = RequestMethod.GET)
- public Result countBusiness(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户ID"));
- return res;
- }
- res.setData(orgCognizanceService.countBusiness(uid));
- return res;
- }
- /**
- * 更改资料填写完成状态
- */
- @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 (StringUtils.isBlank(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;
- }
- /**
- * 高企培育资料完成情况(比重)
- */
- @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;
- }
- /**
- * 管理员"我的客户"列表
- */
- @RequestMapping(value = "/customer", method = RequestMethod.GET)
- public Result getCustomer() {
- Result res = new Result();
- res.setData(userService.selectUserByAid(TokenManager.getAdminId()));
- return res;
- }
- /**
- * 管理员本人信息详情
- */
- @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;
- }
- /**
- * 管理员修改本人信息
- */
- @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;
- }
- /**
- * 新增用户
- */
- @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;
- }
- if (UserType.ORGANIZATION.getCode().equals(inputUser.getType())
- && StringUtils.isBlank(inputUser.getUnitName())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "公司名称", "公司名称"));
- return res;
- }
- if (UserType.PERSONAL.getCode().equals(inputUser.getType()) && StringUtils.isBlank(inputUser.getUsername())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户名称", "用户名称"));
- 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(UserLevel.GENERAL.getCode());
- u.setAid(TokenManager.getAdminId());
- userService.insertRegister(u, "", inputUser.getUnitName(), inputUser.getUsername());
- return res;
- }
- /**
- * 个人用户列表
- */
- @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;
- }
- /**
- * 个人用户信息明细
- */
- @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.selectUserIdentityByUserIdAdmin(uid));
- return res;
- }
- /**
- * 修改个人用户信息
- */
- @RequestMapping(value = "/updateUserDetail", method = RequestMethod.POST)
- public Result updateUserDetail(@Valid InputUserIdentity userIdentity, BindingResult bindingResult,
- String paymentDateFormattedDate, String saveSign) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- UserIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(userIdentity.getId())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到认证ID", "认证ID"));
- return res;
- }
- if (StringUtils.isBlank(userIdentity.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (StringUtils.isBlank(saveSign)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到保存提交方式", "保存提交方式"));
- return res;
- }
- Integer level = userIdentity.getLevel();
- if (!UserLevel.GENERAL.getCode().equals(level)) {
- User u = userService.selectByPrimaryKey(userIdentity.getUid());
- if (UserLevel.GENERAL.getCode().equals(u.getLvl())) {
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
- return res;
- }
- }
- if (!saveSign.equals(CertifySubmitType.SAVE.getCode())
- && !saveSign.equals(CertifySubmitType.SUBMIT.getCode())) {
- res.getError().add(buildError(ErrorConstants.PARAM_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 (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
- User u = userService.selectByPrimaryKey(userIdentity.getUid());
- if (!UserLevel.GENERAL.getCode().equals(u.getLvl())) {
- res.getError().add(buildError("", "已通过实名认证,无法操作!"));
- return res;
- }
- ui.setProcess(IdentityProcess.COMMITTED.getCode());
- ui.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
- }
- res.setData(userIdentityService.updateUserDetail(ui, saveSign, level));
- return res;
- }
- /**
- * 团体用户列表
- */
- @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;
- }
- /**
- * 团体用户明细
- */
- @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.selectOrgIdentityDetailByUserIdAdmin(uid));
- return res;
- }
- /**
- * 修改团体用户信息
- */
- @RequestMapping(value = "/updateOrgDetail", method = RequestMethod.POST)
- public Result updateOrgDetail(@Valid InputOrganizationIdentity orgIdentity, BindingResult bindingResult,
- String paymentDateFormattedDate, String saveSign) {
- Result res = new Result();
- if (bindingResult.hasErrors()) {
- res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
- OrganizationIdentityFields.getFieldDesc(bindingResult.getFieldError().getField())));
- return res;
- }
- if (StringUtils.isBlank(orgIdentity.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- if (StringUtils.isBlank(saveSign)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到保存提交方式", "保存提交方式"));
- return res;
- }
- if (!saveSign.equals(CertifySubmitType.SAVE.getCode())
- && !saveSign.equals(CertifySubmitType.SUBMIT.getCode())) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "保存提交方式"));
- return res;
- }
- Integer level = orgIdentity.getLevel();
- if (!UserLevel.GENERAL.getCode().equals(level)) {
- User u = userService.selectByPrimaryKey(orgIdentity.getUid());
- if (UserLevel.GENERAL.getCode().equals(u.getLvl())) {
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
- 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 (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
- User u = userService.selectByPrimaryKey(oi.getUid());
- if (!UserLevel.GENERAL.getCode().equals(u.getLvl())) {
- res.getError().add(buildError("", "已通过实名认证,无法操作!"));
- return res;
- }
- oi.setProcess(IdentityProcess.COMMITTED.getCode());
- oi.setAuditStatus(IdentityAuditStatus.COMMITTED.getCode());
- }
- res.setData(organizationIdentityService.updateOrgDetail(oi, saveSign, level));
- return res;
- }
- /**
- * 团体用户人力资源情况列表
- */
- @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;
- }
- /**
- * 新增及修改团体用户人力资源情况
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgHumanResourceService.insert(ohr);
- } else {
- orgHumanResourceService.updateByPrimaryKeySelective(ohr);
- }
- return res;
- }
- /**
- * 企业花名册上传
- */
- @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;
- }
- /**
- * 企业社保情况表上传
- */
- @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;
- }
- /**
- * 企业花名册及社保情况表下载
- */
- @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;
- }
- /**
- * 删除团体人力资源
- *
- * @return
- */
- @RequestMapping(value = "/deleteHumanResource", method = RequestMethod.POST)
- public Result deleteHumanResource(@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 {
- orgHumanResourceService.batchDeleteByPrimaryKey(Arrays.asList(ids));
- }
- return res;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细列表
- */
- @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;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细新增及修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- 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;
- }
- /**
- * 上传标准制定附件
- */
- @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;
- }
- /**
- * 下载标准制定附件
- */
- @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;
- }
- /**
- * 删除标准制定情况记录
- */
- @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;
- }
- /**
- * 知识产权列表
- */
- @RequestMapping(value = "/intellectualList", method = RequestMethod.POST)
- public Result intellectualList(String pageNo, String pageSize, String uid, String startDate, String endDate) {
- 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, startDate, endDate));
- return res;
- }
- /**
- * 知识产权详情
- */
- @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().equals(type)) {
- res.setData(orgIntellectualPropertyService.selectPatentTypeDetail(id));
- } else if (IntellectualPropertyType.COPYRIGHT.getCode().equals(type)) {
- res.setData(orgIntellectualPropertyService.selectCopyrightTypeDetail(id));
- } else if (IntellectualPropertyType.COMMON.getCode().equals(type)) {
- OrgIntellectualPropertyDetailBo oipdb = new OrgIntellectualPropertyDetailBo();
- BeanUtils.copyProperties(oip, oipdb);
- res.setData(oipdb);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "知识产权TYPE"));
- }
- return res;
- }
- /**
- * 知识产权信息新增及修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- 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;
- }
- /**
- * 知识产权证书上传
- */
- @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;
- }
- /**
- * 知识产权证书下载
- */
- @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;
- }
- /**
- * 知识产权稿件下载
- */
- @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;
- }
- /**
- * 删除知识产权记录
- */
- @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;
- }
- /**
- * 上年度高新技术产品(服务)情况列表
- */
- @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;
- }
- /**
- * 上年度高新技术产品(服务)情况(新增+修改)
- */
- @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())) {
- OrgTechProduct product = orgTechProductService.findBySerialNumberAndUid(otp.getSerialNumber(),
- otp.getUid());
- if (null != product) {
- res.getError().add(buildError("", "产品编号重复,无法保存!"));
- return res;
- }
- otp.setId(UUID.randomUUID().toString());
- otp.setDeletedSign(DeleteStatus.UNDELETE.getCode());
- 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;
- }
- /**
- * 高新技术产品台帐上传
- */
- @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;
- }
- /**
- * 高新技术产品台帐下载
- */
- @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;
- }
- /**
- * 删除上年度高新技术产品(服务)情况记录
- */
- @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;
- }
- /**
- * 企业研究开发活动情况表入口
- */
- @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;
- }
- /**
- * 研发活动详情
- */
- @RequestMapping(value = "/activityDetail", method = RequestMethod.GET)
- public Result activityDetail(String id) {
- Result res = new Result();
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "研发活动id"));
- return res;
- }
- Calendar a = Calendar.getInstance();
- res.setData(orgActivityService.selectDetailByIdAndYear(id, a.get(Calendar.YEAR) - 1));
- return res;
- }
- /**
- * 企业研究开发活动情况新增、修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- if (StringUtils.isBlank(oa.getId())) {
- oa.setId(UUID.randomUUID().toString());
- orgActivityService.insert(oa);
- } else {
- orgActivityService.updateOrgActivity(oa);
- }
- res.setData(orgActivity);
- return res;
- }
- /**
- * 研发活动立项证明材料上传
- */
- @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;
- }
- /**
- * 研发活动立项证明材料下载
- */
- @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;
- }
- /**
- * 删除企业研究开发活动情况
- */
- @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;
- }
- /**
- * 企业年度研究开发费用结构明细表列表
- */
- @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;
- }
- /**
- * 企业年度研究开发费用结构明细表(新增+修改)
- */
- @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 (null != orgActivityCostService.selectOrgActivityCostByAidAndYear(oac.getAid(), oac.getYear())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目当前年份费用详情已录入!"));
- return res;
- }
- if (StringUtils.isBlank(oac.getId())) {
- 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(DeleteStatus.UNDELETE.getCode());
- orgActivityCostService.insert(oac);
- } else {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到研发活动", "研发活动ID"));
- return res;
- }
- } else {
- orgActivityCostService.updateByPrimaryKeySelective(oac);
- }
- return res;
- }
- /**
- * 研发活动费用台帐上传
- */
- @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;
- }
- /**
- * 研发活动费用台帐下载
- */
- @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;
- }
- /**
- * 获取当前用户已录入项目标号列表
- */
- @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;
- }
- /**
- * 企业纳税申报信息列表
- */
- @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;
- }
- /**
- * 企业纳税信息详情(获取同年度财务报表重复数据)
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgRatepayService.insert(rate);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
- return res;
- }
- } else {
- orgRatepayService.updateByPrimaryKeySelective(rate);
- }
- return res;
- }
- /**
- * 企业纳税申报表上传
- */
- @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;
- }
- /**
- * 企业纳税申报表下载
- */
- @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;
- }
- /**
- * 刪除企业纳税申报信息
- */
- @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;
- }
- /**
- * 财务报表信息列表
- */
- @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;
- }
- /**
- * 财务报表详情(获取同年度纳税申报表重复数据)
- */
- @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;
- }
- /**
- * 财务报表录入+修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgFinanceService.insert(of);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
- return res;
- }
- } else {
- orgFinanceService.updateByPrimaryKeySelective(of);
- }
- return res;
- }
- /**
- * 企业财务报表上传
- */
- @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;
- }
- /**
- * 企业财务报表下载
- */
- @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;
- }
- /**
- * 删除财务报表
- */
- @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;
- }
- /**
- * 科技成果转化情况列表
- */
- @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;
- }
- /**
- * 科技成果转化情况新增+修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgTechAchievementService.insert(ota);
- } else {
- orgTechAchievementService.updateByPrimaryKeySelective(ota);
- }
- return res;
- }
- /**
- * 科技成果附件上传
- */
- @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;
- }
- /**
- * 科技成果附件下载
- */
- @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;
- }
- /**
- * 删除科技成果转化情况
- */
- @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;
- }
- /**
- * 企业荣誉及其他证明材料列表
- */
- @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;
- }
- /**
- * 企业荣誉及其他证明材料新增+修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgHonorDatumService.insert(ohd);
- } else {
- orgHonorDatumService.updateByPrimaryKeySelective(ohd);
- }
- return res;
- }
- /**
- * 荣誉及其他证明材料上传
- */
- @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;
- }
- /**
- * 荣誉及其他证明材料下载
- */
- @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;
- }
- /**
- * 删除企业荣誉及其他证明材料
- */
- @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;
- }
- /**
- * 技术中心入口
- */
- @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;
- }
- /**
- * 技术中心新增+修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgTechCenterService.insert(otc);
- } else {
- orgTechCenterService.updateByPrimaryKeySelective(otc);
- }
- return res;
- }
- /**
- * 研发部门制度上传
- */
- @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;
- }
- /**
- * 研发部门制度下载
- */
- @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;
- }
- /**
- * 产学研情况列表
- */
- @RequestMapping(value = "/centerDetail", method = RequestMethod.GET)
- public Result centerDetail(String pageNo, String pageSize, String cid) {
- 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(orgTechCenterDetailService.listOrgTechCenterDetail(pNo, pSize, cid));
- return res;
- }
- /**
- * 产学研情况新增+修改
- */
- @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(orgTechCenterDetail.getCid())) {
- res.getError().add(buildError(ErrorConstants.STATUS_ERROR, "研发部门相关信息未保存,无法保存!"));
- 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(DeleteStatus.UNDELETE.getCode());
- orgTechCenterDetailService.insert(otcd);
- } else {
- orgTechCenterDetailService.updateByPrimaryKeySelective(otcd);
- }
- return res;
- }
- /**
- * 产学研技术中心协议上传
- */
- @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;
- }
- /**
- * 产学研技术中心协议下载
- */
- @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;
- }
- /**
- * 删除技术中心明细
- */
- @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;
- }
- /**
- * 获取公司联系人
- */
- @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<OrgUnitNames> list = organizationIdentityService.selectAllOrgIndentity();
- Map<String, String> map = new TreeMap<String, String>();
- for (OrgUnitNames o : list) {
- map.put(o.getUid(), o.getUnitName());
- }
- res.setData(map);
- return res;
- }
- /**
- * 高企认定列表
- */
- @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
- public Result listCognizance(String contractId, String uid, String unitName, Integer 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(contractId, uid, unitName, locationProvince, pNo, pSize));
- return res;
- }
- /**
- * 高企认定咨询师下拉列表
- */
- @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;
- }
- /**
- * 高企负责人下拉
- */
- @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() + " " + (null == o.getPosition() ? "" : o.getPosition()));
- }
- res.setData(map);
- return res;
- }
- /**
- * 申请高企认定
- */
- @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 (StringUtils.isBlank(cog.getSalesman())) {
- 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;
- }
- Integer latelyYear = orgCognizanceService.selectLatelyRecordYear(cog.getUid());
- if (null != latelyYear && cog.getYear() - latelyYear < 4) {
- res.getError()
- .add(buildError(ErrorConstants.STATUS_ERROR, "高企认定申请中或认定未到期!无法提交新申请!", "高企认定申请中或认定未到期!无法提交新申请!"));
- return res;
- }
- String salesman = cog.getSalesman();
- OrgCognizance oc = new OrgCognizance();
- BeanUtils.copyProperties(cog, oc);
- orgCognizanceService.saveCognizance(oc, salesman);
- return res;
- }
- /**
- * 高企认定详情入口
- */
- @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;
- }
- OrgCognizance oc = orgCognizanceService.selectByPrimaryKey(cid);
- if (null == oc) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID"));
- return res;
- }
- if (year - oc.getYear() != 0) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "高企ID及年份"));
- return res;
- }
- res.setData(handleCognizanceDetail(uid, cid, year));
- return res;
- }
- /**
- * 高企认定流转状态下拉
- */
- @RequestMapping(value = "/cognizanceStatus", method = RequestMethod.GET)
- public Result cognizanceStatus() {
- Result res = new Result();
- res.setData(disposeCognizanceStatus());
- return res;
- }
- /**
- * 高企认定流转状态
- */
- @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;
- }
- /**
- * 保存高企认定详情
- */
- @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;
- }
- if (null == cog.getYear()) {
- 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 (OrgCognizanceStatus.REJECT.getCode() == o.getState()) {
- res.getError().add(buildError(ErrorConstants.RECORD_REJECT, "当前申请未通过,无法修改,请重新申请"));
- 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;
- }
- /**
- * 刪除高企认定
- */
- @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;
- }
- /**
- * 企业创新能力入口
- */
- @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;
- }
- /**
- * 企业创新能力新增+保存
- */
- @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;
- }
- /**
- * 年报列表
- */
- @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;
- }
- /**
- * 企业年报详情
- */
- @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;
- }
- /**
- * 高企年报新增+修改
- */
- @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(DeleteStatus.UNDELETE.getCode());
- orgAnnualReportService.insert(oar);
- }
- } else {
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- oar.setLastUpdateTime(now.getTime());
- orgAnnualReportService.updateByPrimaryKeySelective(oar);
- }
- return res;
- }
- /**
- * 删除企业年报记录
- */
- @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;
- }
- /**
- * 高企培育列表
- */
- @RequestMapping(value = "/cultivate", method = RequestMethod.POST)
- public Result cultivationList(String uid, Integer locationProvince, 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, locationProvince, 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;
- }
- }
|