| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115 |
- 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.beans.factory.annotation.Autowired;
- 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.shiro.token.TokenManager;
- import com.goafanti.easemob.EasemobUtils;
- import com.goafanti.easemob.enums.EasemonSysUsers;
- 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.OrgUnitNames;
- 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;
- @Autowired
- EasemobUtils easemobUtils;
- /**
- * 获取营销员及营销经理下拉
- */
- @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, Integer year) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户ID"));
- return res;
- }
- if (null == year) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到年份", "年份"));
- return res;
- }
- res.setData(orgCognizanceService.countBusiness(uid, year));
- 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;
- }
- OrgCognizanceProportion oo = orgCognizanceProportionService.selectByUid(uid);
- if (null == oo && 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;
- }
- if (StringUtils.isBlank(id)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "比重ID"));
- 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(Integer number, String mobile, Integer auditStatus, String auditName, String email,
- String startCreateTime, String endCreateTime, Integer type, String pageNo, String pageSize) {
- Result res = new Result();
- if (null == type) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "用户类型", "用户类型"));
- return res;
- }
- if (!UserType.PERSONAL.getCode().equals(type) && !UserType.ORGANIZATION.getCode().equals(type)) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "用户类型", "用户类型"));
- 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(userService.selectUserByAid(number, mobile, auditStatus, auditName, email,
- TokenManager.getAdminId(), startCreateTime, endCreateTime, type, pNo, pSize));
- 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;
- }
- User user = userService.selectByMobieAndType(inputUser.getMobile().trim(), null);
- if (null != user) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- User u = new User();
- u.setId(UUID.randomUUID().toString());
- u.setMobile(inputUser.getMobile().trim());
- u.setPassword(inputUser.getMobile().trim());
- 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 = "/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;
- }
- UserIdentity idd = userIdentityService.selectUserIdentityByUserId(userIdentity.getUid());
- if (IdentityAuditStatus.COMMITTED.getCode().equals(idd.getAuditStatus())) {
- res.getError().add(buildError("", "审核中,无法保存或提交!"));
- 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 = "/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;
- }
- OrganizationIdentity idd = organizationIdentityService.selectOrgIdentityByUserId(orgIdentity.getUid());
- if (IdentityAuditStatus.COMMITTED.getCode().equals(idd.getAuditStatus())) {
- res.getError().add(buildError("", "审核中,无法保存或提交!"));
- 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 (orgIdentity.getRegisteredCapital() != null) {
- oi.setRegisteredCapital(new BigDecimal(orgIdentity.getRegisteredCapital()));
- }
- 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(Integer year, 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(year, 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 (null == orgIntellectualProperty.getCatagory()) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到类别", "类别"));
- return res;
- }
- if (!checkCertify(res, orgIntellectualProperty.getUid()).getError().isEmpty()) {
- return res;
- }
- OrgIntellectualProperty p = orgIntellectualPropertyService.findByUidAndIntellectualPropertyNumber(
- orgIntellectualProperty.getUid(), orgIntellectualProperty.getIntellectualPropertyNumber());
- 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())) {
- if (null != p) {
- res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
- return res;
- }
- 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 {
- if (null != p && !p.getId().equals(oip.getId())) {
- res.getError().add(buildError("", "当前知识产权编号已录入,无法重复提交!"));
- return res;
- }
- oip.setEvaluationCategory((oip.getCatagory() >= 2 && oip.getCatagory() <= 4) ? 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(orgActivity.getActivityNumber())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "研发活动编号"));
- return res;
- }
- if (StringUtils.isBlank(startDateFormattedDate)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "开始时间"));
- return res;
- }
- if (StringUtils.isBlank(endDateFormattedDate)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "结束时间"));
- return res;
- }
- try {
- orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- try {
- orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD));
- } catch (ParseException e) {
- }
- OrgActivity oa = new OrgActivity();
- BeanUtils.copyProperties(orgActivity, oa);
- if (StringUtils.isBlank(oa.getId())) {
- oa.setId(UUID.randomUUID().toString());
- oa.setDeletedSign(DeleteStatus.UNDELETE.getCode());
- 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);
- OrgActivityCost ccc = orgActivityCostService.selectOrgActivityCostByAidAndYear(oac.getAid(), oac.getYear());
- OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(oac.getAid());
- if (StringUtils.isBlank(oac.getId())) {
- if (null != ccc) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目当前年份费用详情已录入!"));
- return res;
- }
- if (null != ac) {
- res = disposeActivityYear(res, ac, oac);
- if (!res.getError().isEmpty()) {
- 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 {
- if (null != ccc && !ccc.getId().equals(oac.getId())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "该研究项目当前年份费用详情已录入!"));
- return res;
- }
- res = disposeActivityYear(res, ac, oac);
- if (!res.getError().isEmpty()) {
- return res;
- }
- 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.isBlank(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 (StringUtils.isBlank(orgTechCenter.getCenterName())) {
- res.getError().add(buildError(ErrorConstants.DATA_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;
- }
- if (OrgCognizanceStatus.getStatus(cog.getState()) == OrgCognizanceStatus.ISSUING
- && StringUtils.isBlank(cog.getCertificateNumber())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "证书编号"));
- 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());
- if (cog.getState() != null && !cog.getState().equals(o.getState())
- && cog.getState() <= OrgCognizanceStatus.CALLBACK.getCode()
- && cog.getState() >= OrgCognizanceStatus.PREPARE.getCode()) {
- easemobUtils.sendMessage(EasemonSysUsers.ADMIN_DDDT.getUsername(),
- userService.selectNumberByPrimaryKey(o.getUid()), "您的科技项目申报订单:#%s,状态变更为%s", o.getSerialNumber(),
- OrgCognizanceStatus.getStatus(cog.getState()).getDesc());
- }
- 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())) {
- UserAbility uu = userAbilityService.selectUserAbilityByUserId(user.getUid());
- if (null != uu) {
- BeanUtils.copyProperties(user, uu);
- userAbilityService.updateByPrimaryKeySelective(uu);
- } else {
- 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;
- }
- // 高企详情
- 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;
- }
- private Result disposeActivityYear(Result res, OrgActivity ac, OrgActivityCost oac) {
- 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;
- }
- return res;
- }
- }
|