AdminApiController.java 103 KB

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