AdminApiController.java 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304
  1. package com.goafanti.admin.controller;
  2. import java.io.IOException;
  3. import java.math.BigDecimal;
  4. import java.text.ParseException;
  5. import java.util.ArrayList;
  6. import java.util.Calendar;
  7. import java.util.Collections;
  8. import java.util.LinkedHashMap;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.UUID;
  12. import javax.annotation.Resource;
  13. import javax.servlet.http.HttpServletRequest;
  14. import org.apache.commons.lang3.time.DateFormatUtils;
  15. import org.springframework.stereotype.Controller;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestMethod;
  18. import org.springframework.web.bind.annotation.RequestParam;
  19. import org.springframework.web.multipart.MultipartFile;
  20. import com.goafanti.admin.service.AftFileService;
  21. import com.goafanti.common.bo.Result;
  22. import com.goafanti.common.constant.ErrorConstants;
  23. import com.goafanti.common.controller.BaseApiController;
  24. import com.goafanti.common.model.Admin;
  25. import com.goafanti.common.model.AftFile;
  26. import com.goafanti.common.model.OrgActivity;
  27. import com.goafanti.common.model.OrgActivityCost;
  28. import com.goafanti.common.model.OrgAnnualReport;
  29. import com.goafanti.common.model.OrgCognizance;
  30. import com.goafanti.common.model.OrgCognizanceLog;
  31. import com.goafanti.common.model.OrgFinance;
  32. import com.goafanti.common.model.OrgHonorDatum;
  33. import com.goafanti.common.model.OrgHumanResource;
  34. import com.goafanti.common.model.OrgIntellectualProperty;
  35. import com.goafanti.common.model.OrgRatepay;
  36. import com.goafanti.common.model.OrgStandard;
  37. import com.goafanti.common.model.OrgTechAchievement;
  38. import com.goafanti.common.model.OrgTechCenter;
  39. import com.goafanti.common.model.OrgTechProduct;
  40. import com.goafanti.common.model.OrganizationIdentity;
  41. import com.goafanti.common.model.User;
  42. import com.goafanti.common.model.UserAbility;
  43. import com.goafanti.common.model.UserIdentity;
  44. import com.goafanti.common.utils.DateUtils;
  45. import com.goafanti.common.utils.LoggerUtils;
  46. import com.goafanti.common.utils.PasswordUtil;
  47. import com.goafanti.common.utils.StringUtils;
  48. import com.goafanti.core.mybatis.page.Pagination;
  49. import com.goafanti.core.shiro.token.TokenManager;
  50. import com.goafanti.techservice.cognizance.bo.ActivityNumberBo;
  51. import com.goafanti.techservice.cognizance.bo.AnnualReportBo;
  52. import com.goafanti.techservice.cognizance.bo.AnnualReportMainBo;
  53. import com.goafanti.techservice.cognizance.bo.AnnualReportPropertyRightBo;
  54. import com.goafanti.techservice.cognizance.bo.CognizanceCatagoryBo;
  55. import com.goafanti.techservice.cognizance.bo.CognizanceDetailBo;
  56. import com.goafanti.techservice.cognizance.bo.CognizanceManageCostBo;
  57. import com.goafanti.techservice.cognizance.bo.CognizanceOrgInfoBo;
  58. import com.goafanti.techservice.cognizance.bo.CognizanceResearchCostBo;
  59. import com.goafanti.techservice.cognizance.service.OrgActivityCostService;
  60. import com.goafanti.techservice.cognizance.service.OrgActivityService;
  61. import com.goafanti.techservice.cognizance.service.OrgAnnualReportService;
  62. import com.goafanti.techservice.cognizance.service.OrgCognizanceLogService;
  63. import com.goafanti.techservice.cognizance.service.OrgCognizanceService;
  64. import com.goafanti.techservice.cognizance.service.OrgFinanceService;
  65. import com.goafanti.techservice.cognizance.service.OrgHonorDatumService;
  66. import com.goafanti.techservice.cognizance.service.OrgIntellectualPropertyService;
  67. import com.goafanti.techservice.cognizance.service.OrgRatepayService;
  68. import com.goafanti.techservice.cognizance.service.OrgStandardService;
  69. import com.goafanti.techservice.cognizance.service.OrgTechAchievementService;
  70. import com.goafanti.techservice.cognizance.service.OrgTechCenterService;
  71. import com.goafanti.techservice.cognizance.service.OrgTechProductService;
  72. import com.goafanti.techservice.patent.service.AdminService;
  73. import com.goafanti.user.bo.OrgListBo;
  74. import com.goafanti.user.bo.UserListBo;
  75. import com.goafanti.user.service.OrgHumanResourceService;
  76. import com.goafanti.user.service.OrganizationIdentityService;
  77. import com.goafanti.user.service.UserAbilityService;
  78. import com.goafanti.user.service.UserIdentityService;
  79. import com.goafanti.user.service.UserService;
  80. @Controller
  81. @RequestMapping(value = "/api/admin")
  82. public class AdminApiController extends BaseApiController {
  83. @Resource
  84. private UserService userService;
  85. @Resource
  86. private UserIdentityService userIdentityService;
  87. @Resource
  88. private OrganizationIdentityService organizationIdentityService;
  89. @Resource
  90. private OrgHumanResourceService orgHumanResourceService;
  91. @Resource
  92. private OrgStandardService orgStandardService;
  93. @Resource
  94. private OrgIntellectualPropertyService orgIntellectualPropertyService;
  95. @Resource
  96. private OrgTechProductService orgTechProductService;
  97. @Resource
  98. private OrgRatepayService orgRatepayService;
  99. @Resource
  100. private OrgFinanceService orgFinanceService;
  101. @Resource
  102. private OrgActivityService orgActivityService;
  103. @Resource
  104. private OrgActivityCostService orgActivityCostService;
  105. @Resource
  106. private OrgTechAchievementService orgTechAchievementService;
  107. @Resource
  108. private OrgHonorDatumService orgHonorDatumService;
  109. @Resource
  110. private OrgTechCenterService orgTechCenterService;
  111. @Resource
  112. private OrgCognizanceService orgCognizanceService;
  113. @Resource
  114. private OrgCognizanceLogService orgCognizanceLogService;
  115. @Resource
  116. private UserAbilityService userAbilityService;
  117. @Resource
  118. private OrgAnnualReportService orgAnnualReportService;
  119. @Resource
  120. private AftFileService aftFileService;
  121. @Resource(name = "passwordUtil")
  122. private PasswordUtil passwordUtil;
  123. @Resource
  124. private AdminService adminService;
  125. /**
  126. * 新增用户
  127. * @param mobile
  128. * @param type
  129. * @param unitName
  130. * @return
  131. */
  132. @RequestMapping(value = "/addNewUser", method = RequestMethod.POST)
  133. public Result addNewUser(String mobile, Integer type, String unitName){
  134. Result res = new Result();
  135. User user = userService.selectByMobieAndType(mobile, type);
  136. if (null != user) {
  137. res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
  138. return res;
  139. }
  140. User u = new User();
  141. u.setId(UUID.randomUUID().toString());
  142. u.setMobile(mobile);
  143. u.setPassword(mobile);
  144. u.setType(type);
  145. Calendar now = Calendar.getInstance();
  146. now.set(Calendar.MILLISECOND, 0);
  147. u.setCreateTime(now.getTime());
  148. u.setPassword(passwordUtil.getEncryptPwd(u));
  149. u.setLvl(0);
  150. List<Admin> admins = adminService.selectAllAdmin();
  151. if (!admins.isEmpty()) {
  152. Collections.shuffle(admins);
  153. u.setAid(admins.get(0).getId());
  154. }
  155. userService.insertRegister(u, "", unitName);
  156. return res;
  157. }
  158. /**
  159. * 个人用户列表
  160. *
  161. * @param mobile
  162. * @param email
  163. * @param createTime
  164. * @param number
  165. * @param auditStatus
  166. * @param pageNo
  167. * @param pageSize
  168. * @return
  169. * @throws ParseException
  170. */
  171. @RequestMapping(value = "/userList", method = RequestMethod.POST)
  172. public Result userList(String mobile, String email,
  173. @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
  174. String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
  175. Result res = new Result();
  176. Integer pNo = 1;
  177. Integer pSize = 10;
  178. if (StringUtils.isNumeric(pageSize)) {
  179. pSize = Integer.parseInt(pageSize);
  180. }
  181. if (StringUtils.isNumeric(pageNo)) {
  182. pNo = Integer.parseInt(pageNo);
  183. }
  184. res.setData(getUserList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
  185. return res;
  186. }
  187. /**
  188. * 个人用户信息明细
  189. *
  190. * @param uid
  191. * @return
  192. */
  193. @RequestMapping(value = "/userDetail", method = RequestMethod.POST)
  194. public Result userDetail(String uid) {
  195. Result res = new Result();
  196. res.setData(userIdentityService.selectUserIdentityByUserId(uid));
  197. return res;
  198. }
  199. /**
  200. * 修改个人用户信息
  201. *
  202. * @return
  203. * @throws ParseException
  204. */
  205. @RequestMapping(value = "updateUserDetail", method = RequestMethod.POST)
  206. public Result updateUserDetail(UserIdentity userIdentity, String paymentDateFormattedDate) throws ParseException {
  207. Result res = new Result();
  208. if (!StringUtils.isBlank(paymentDateFormattedDate)) {
  209. userIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, "yyyy-MM-dd"));
  210. }
  211. res.setData(userIdentityService.updateByPrimaryKeySelective(userIdentity));
  212. return res;
  213. }
  214. /**
  215. * 团体用户列表
  216. *
  217. * @param mobile
  218. * @param email
  219. * @param createTime
  220. * @param number
  221. * @param auditStatus
  222. * @param pageNo
  223. * @param pageSize
  224. * @return
  225. * @throws ParseException
  226. */
  227. @RequestMapping(value = "/orgList", method = RequestMethod.POST)
  228. public Result orgList(String mobile, String email,
  229. @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
  230. String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
  231. Result res = new Result();
  232. Integer pNo = 1;
  233. Integer pSize = 10;
  234. if (StringUtils.isNumeric(pageSize)) {
  235. pSize = Integer.parseInt(pageSize);
  236. }
  237. if (StringUtils.isNumeric(pageNo)) {
  238. pNo = Integer.parseInt(pageNo);
  239. }
  240. res.setData(getOrgList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
  241. return res;
  242. }
  243. /**
  244. * 团体用户明细
  245. *
  246. * @param uid
  247. * @return
  248. */
  249. @RequestMapping(value = "/orgDetail", method = RequestMethod.POST)
  250. public Result orgDetail(String uid) {
  251. Result res = new Result();
  252. res.setData(organizationIdentityService.selectOrgIdentityByUserId(uid));
  253. return res;
  254. }
  255. /**
  256. * 修改团体用户信息
  257. *
  258. * @param orgIdentity
  259. * @return
  260. * @throws ParseException
  261. */
  262. @RequestMapping(value = "/updateOrgDetail", method = RequestMethod.POST)
  263. public Result updateOrgDetail(OrganizationIdentity orgIdentity, String paymentDateFormattedDate)
  264. throws ParseException {
  265. Result res = new Result();
  266. if (!StringUtils.isBlank(paymentDateFormattedDate)) {
  267. orgIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, "yyyy-MM-dd"));
  268. }
  269. res.setData(organizationIdentityService.updateByPrimaryKeySelective(orgIdentity));
  270. return res;
  271. }
  272. /**
  273. * 团体用户人力资源情况入口
  274. *
  275. * @param uid
  276. * 用户ID
  277. * @return
  278. */
  279. @RequestMapping(value = "/orgHumanResource", method = RequestMethod.POST)
  280. public Result orgHumanResource(Integer year, String pageNo, String pageSize, String uid) {
  281. Result res = new Result();
  282. res = checkCertify(res, uid);
  283. if (res.getError().isEmpty()) {
  284. Integer pNo = 1;
  285. Integer pSize = 10;
  286. if (StringUtils.isNumeric(pageSize)) {
  287. pSize = Integer.parseInt(pageSize);
  288. }
  289. if (StringUtils.isNumeric(pageNo)) {
  290. pNo = Integer.parseInt(pageNo);
  291. }
  292. res.setData(orgHumanResourceService.listOrgHumanResource(year, pNo, pSize, uid));
  293. }
  294. return res;
  295. }
  296. /**
  297. * 修改团体用户人力资源情况
  298. *
  299. * @param orgHumanResource
  300. * @return
  301. */
  302. @RequestMapping(value = "/updateOrgHumanResource", method = RequestMethod.POST)
  303. public Result updateOrgHumanResource(OrgHumanResource orgHumanResource) {
  304. Result res = new Result();
  305. if (null == orgHumanResource.getId()) {
  306. orgHumanResource.setId(UUID.randomUUID().toString());
  307. orgHumanResourceService.insert(orgHumanResource);
  308. } else {
  309. orgHumanResourceService.updateByPrimaryKeySelective(orgHumanResource);
  310. }
  311. return res;
  312. }
  313. /**
  314. * 企业参与国家标准或行业标准制定情况明细入口
  315. *
  316. * @param uid
  317. * 用户id
  318. * @return
  319. */
  320. @RequestMapping(value = "/standard", method = RequestMethod.POST)
  321. public Result standard(String uid, String standardName, String standardNumber, Integer standardLevel,
  322. Integer participateWay, String pageNo, String pageSize) {
  323. Result res = new Result();
  324. res = checkCertify(res, uid);
  325. if (res.getError().isEmpty()) {
  326. Integer pNo = 1;
  327. Integer pSize = 10;
  328. if (StringUtils.isNumeric(pageSize)) {
  329. pSize = Integer.parseInt(pageSize);
  330. }
  331. if (StringUtils.isNumeric(pageNo)) {
  332. pNo = Integer.parseInt(pageNo);
  333. }
  334. res.setData(orgStandardService.listOrgStandard(standardName, standardNumber, standardLevel, participateWay,
  335. pNo, pSize, uid));
  336. }
  337. return res;
  338. }
  339. /**
  340. * 企业参与国家标准或行业标准制定情况明细修改保存
  341. *
  342. * @param orgStandard
  343. * @return
  344. */
  345. @RequestMapping(value = "/developStandard", method = RequestMethod.POST)
  346. public Result developStandard(OrgStandard orgStandard) {
  347. Result res = new Result();
  348. if (StringUtils.isBlank(orgStandard.getId())) {
  349. orgStandard.setId(UUID.randomUUID().toString());
  350. orgStandard.setDeletedSign(0);
  351. Calendar now = Calendar.getInstance();
  352. now.set(Calendar.MILLISECOND, 0);
  353. orgStandard.setCreateTime(now.getTime());
  354. orgStandardService.insert(orgStandard);
  355. } else {
  356. orgStandardService.updateByPrimaryKeySelective(orgStandard);
  357. }
  358. res.setData(orgStandard);
  359. return res;
  360. }
  361. /**
  362. * 管理端录入+修改知识产权信息
  363. *
  364. * @return
  365. * @throws ParseException
  366. */
  367. @RequestMapping(value = "/intellectual", method = RequestMethod.POST)
  368. public Result intellectual(OrgIntellectualProperty orgIntellectualProperty, String authorizationDateFormattedDate,
  369. String uid) throws ParseException {
  370. Result res = new Result();
  371. if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
  372. orgIntellectualProperty
  373. .setAuthorizationDate(DateUtils.parseDate(authorizationDateFormattedDate, "yyyy-MM-dd"));
  374. }
  375. if (null == orgIntellectualProperty.getId()) {
  376. orgIntellectualProperty.setId(UUID.randomUUID().toString());
  377. orgIntellectualProperty.setUid(uid);
  378. orgIntellectualProperty.setEvaluationCategory(
  379. (orgIntellectualProperty.getCatagory() >= 2 && orgIntellectualProperty.getCatagory() <= 4) ? 1 : 0);
  380. orgIntellectualProperty.setDeletedSign(0);
  381. res.setData(orgIntellectualPropertyService.insert(orgIntellectualProperty));
  382. } else {
  383. orgIntellectualProperty.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
  384. res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(orgIntellectualProperty));
  385. }
  386. return res;
  387. }
  388. /**
  389. * 知识产权列表
  390. *
  391. * @param pageNo
  392. * @param pageSize
  393. * @return
  394. */
  395. @RequestMapping(value = "/intellectualList", method = RequestMethod.POST)
  396. public Result intellectualList(String pageNo, String pageSize, String uid) {
  397. Result res = new Result();
  398. res = checkCertify(res, uid);
  399. if (res.getError().isEmpty()) {
  400. Integer pNo = 1;
  401. Integer pSize = 10;
  402. if (StringUtils.isNumeric(pageSize)) {
  403. pSize = Integer.parseInt(pageSize);
  404. }
  405. if (StringUtils.isNumeric(pageNo)) {
  406. pNo = Integer.parseInt(pageNo);
  407. }
  408. res.setData(orgIntellectualPropertyService.listIntellectual(pNo, pSize, uid));
  409. }
  410. return res;
  411. }
  412. /**
  413. * 上年度高新技术产品(服务)情况列表
  414. *
  415. * @param pageNo
  416. * @param pageSize
  417. * @return
  418. */
  419. @RequestMapping(value = "/techProductList", method = RequestMethod.POST)
  420. public Result techProductList(String pageNo, String pageSize, String uid) {
  421. Result res = new Result();
  422. res = checkCertify(res, uid);
  423. if (res.getError().isEmpty()) {
  424. Integer pNo = 1;
  425. Integer pSize = 10;
  426. if (StringUtils.isNumeric(pageSize)) {
  427. pSize = Integer.parseInt(pageSize);
  428. }
  429. if (StringUtils.isNumeric(pageNo)) {
  430. pNo = Integer.parseInt(pageNo);
  431. }
  432. res.setData(orgTechProductService.listTechProduct(pNo, pSize, uid));
  433. }
  434. return res;
  435. }
  436. /**
  437. * 企业研究开发活动情况表入口
  438. *
  439. * @param activityNumber
  440. * @param activityName
  441. * @param startDate
  442. * @param endDate
  443. * @param pageNo
  444. * @param pageSize
  445. * @return
  446. * @throws ParseException
  447. */
  448. @RequestMapping(value = "/activityList", method = RequestMethod.POST)
  449. public Result activityList(String activityNumber, String activityName, String startDateFormattedDate,
  450. String endDateFormattedDate, String pageNo, String pageSize, String uid) throws ParseException {
  451. Result res = new Result();
  452. res = checkCertify(res, uid);
  453. if (res.getError().isEmpty()) {
  454. Integer pNo = 1;
  455. Integer pSize = 10;
  456. if (StringUtils.isNumeric(pageSize)) {
  457. pSize = Integer.parseInt(pageSize);
  458. }
  459. if (StringUtils.isNumeric(pageNo)) {
  460. pNo = Integer.parseInt(pageNo);
  461. }
  462. res.setData(orgActivityService.listOrgActivity(activityNumber, activityName, startDateFormattedDate,
  463. endDateFormattedDate, pNo, pSize, uid));
  464. }
  465. return res;
  466. }
  467. /**
  468. * 企业研究开发活动情况新增、修改
  469. *
  470. * @param orgActivity
  471. * @return
  472. * @throws ParseException
  473. */
  474. @RequestMapping(value = "/activity", method = RequestMethod.POST)
  475. public Result activity(OrgActivity orgActivity, String startDateFormattedDate, String endDateFormattedDate)
  476. throws ParseException {
  477. Result res = new Result();
  478. orgActivity.setDeletedSign(0);
  479. if (!StringUtils.isBlank(startDateFormattedDate)) {
  480. orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, "yyyy-MM-dd"));
  481. }
  482. if (StringUtils.isBlank(endDateFormattedDate)) {
  483. orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, "yyyy-MM-dd"));
  484. }
  485. if (StringUtils.isBlank(orgActivity.getId())) {
  486. orgActivity.setId(UUID.randomUUID().toString());
  487. orgActivity.setUid(TokenManager.getUserId());
  488. orgActivityService.insert(orgActivity);
  489. } else {
  490. orgActivityService.updateByPrimaryKeySelective(orgActivity);
  491. Boolean flag = false;
  492. OrgActivityCost cost = orgActivityCostService.selectOrgActivityCostByAid(orgActivity.getId());
  493. if (null != cost) {
  494. if (!StringUtils.isBlank(orgActivity.getActivityNumber())) {
  495. cost.setActivityNumber(orgActivity.getActivityNumber());
  496. flag = true;
  497. }
  498. if (null == orgActivity.getStartDate()) {
  499. cost.setStartDate(orgActivity.getStartDate());
  500. flag = true;
  501. }
  502. if (null == orgActivity.getEndDate()) {
  503. cost.setEndDate(orgActivity.getEndDate());
  504. flag = true;
  505. }
  506. }
  507. if (flag) {
  508. orgActivityCostService.updateByPrimaryKeySelective(cost);
  509. }
  510. }
  511. res.setData(orgActivity);
  512. return res;
  513. }
  514. /**
  515. * 企业年度研究开发费用结构明细表列表入口
  516. *
  517. * @return
  518. * @throws ParseException
  519. */
  520. @RequestMapping(value = "/activityCostList", method = RequestMethod.POST)
  521. public Result activityCostList(String activityNumber, String startDateFormattedDate, String endDateFormattedDate,
  522. String pageNo, String pageSize, String uid) throws ParseException {
  523. Result res = new Result();
  524. res = checkCertify(res, uid);
  525. if (res.getError().isEmpty()) {
  526. Integer pNo = 1;
  527. Integer pSize = 10;
  528. if (StringUtils.isNumeric(pageSize)) {
  529. pSize = Integer.parseInt(pageSize);
  530. }
  531. if (StringUtils.isNumeric(pageNo)) {
  532. pNo = Integer.parseInt(pageNo);
  533. }
  534. res.setData(orgActivityCostService.listOrgActivityCost(activityNumber, startDateFormattedDate,
  535. endDateFormattedDate, pNo, pSize, uid));
  536. }
  537. return res;
  538. }
  539. /**
  540. * 企业年度研究开发费用结构明细表(新增+修改)
  541. *
  542. * @return
  543. * @throws ParseException
  544. */
  545. @RequestMapping(value = "/activityCost", method = RequestMethod.POST)
  546. public Result activityCost(OrgActivityCost orgActivityCost, String signDateFormattedDate) throws ParseException {
  547. Result res = new Result();
  548. if (StringUtils.isBlank(signDateFormattedDate)) {
  549. orgActivityCost.setSignDate(DateUtils.parseDate(signDateFormattedDate, "yyyy-MM-dd"));
  550. }
  551. if (null == orgActivityCost.getId()) {
  552. OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(orgActivityCost.getAid());
  553. orgActivityCost.setStartDate(ac.getStartDate());
  554. orgActivityCost.setEndDate(ac.getEndDate());
  555. orgActivityCost.setId(UUID.randomUUID().toString());
  556. orgActivityCost.setUid(TokenManager.getUserId());
  557. orgActivityCost.setDeletedSign(0);
  558. orgActivityCostService.insert(orgActivityCost);
  559. } else {
  560. orgActivityCostService.updateByPrimaryKeySelective(orgActivityCost);
  561. }
  562. return res;
  563. }
  564. /**
  565. * 上年度高新技术产品(服务)情况(新增+修改)
  566. *
  567. * @param orgTechProduct
  568. * @return
  569. */
  570. @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
  571. public Result techProduct(OrgTechProduct orgTechProduct) {
  572. Result res = new Result();
  573. if (null == orgTechProduct.getId()) {
  574. orgTechProduct.setId(UUID.randomUUID().toString());
  575. orgTechProduct.setDeletedSign(0);
  576. Calendar now = Calendar.getInstance();
  577. now.set(Calendar.MILLISECOND, 0);
  578. orgTechProduct.setCreateTime(now.getTime());
  579. orgTechProduct.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
  580. orgTechProductService.insert(orgTechProduct);
  581. } else {
  582. orgTechProductService.updateByPrimaryKeySelective(orgTechProduct);
  583. }
  584. res.setData(orgTechProduct);
  585. return res;
  586. }
  587. /**
  588. * 企业纳税申报信息入口
  589. *
  590. * @return
  591. */
  592. @RequestMapping(value = "/ratepay", method = RequestMethod.POST)
  593. public Result ratepay(Integer year, String pageNo, String pageSize, String uid) {
  594. Result res = new Result();
  595. res = checkCertify(res, uid);
  596. if (res.getError().isEmpty()) {
  597. Integer pNo = 1;
  598. Integer pSize = 10;
  599. if (StringUtils.isNumeric(pageSize)) {
  600. pSize = Integer.parseInt(pageSize);
  601. }
  602. if (StringUtils.isNumeric(pageNo)) {
  603. pNo = Integer.parseInt(pageNo);
  604. }
  605. res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, uid));
  606. }
  607. return res;
  608. }
  609. /**
  610. * 企业纳税申报信息录入+修改
  611. */
  612. @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
  613. public Result disposeRatepay(OrgRatepay orgRatepay) {
  614. Result res = new Result();
  615. if (null == orgRatepay.getId()) {
  616. if (null == orgRatepayService.selectRatepayByUidAndYear(orgRatepay.getUid(), orgRatepay.getYear())) {
  617. orgRatepay.setId(UUID.randomUUID().toString());
  618. orgRatepay.setDeletedSign(0);
  619. orgRatepayService.insert(orgRatepay);
  620. } else {
  621. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
  622. return res;
  623. }
  624. } else {
  625. orgRatepayService.updateByPrimaryKeySelective(orgRatepay);
  626. }
  627. return res;
  628. }
  629. /**
  630. * 财务报表信息入口
  631. *
  632. * @return
  633. */
  634. @RequestMapping(value = "/finance", method = RequestMethod.POST)
  635. public Result finance(Integer year, String pageNo, String pageSize, String uid) {
  636. Result res = new Result();
  637. res = checkCertify(res, uid);
  638. if (res.getError().isEmpty()) {
  639. Integer pNo = 1;
  640. Integer pSize = 10;
  641. if (StringUtils.isNumeric(pageSize)) {
  642. pSize = Integer.parseInt(pageSize);
  643. }
  644. if (StringUtils.isNumeric(pageNo)) {
  645. pNo = Integer.parseInt(pageNo);
  646. }
  647. res.setData(orgFinanceService.listFinance(year, pNo, pSize, uid));
  648. }
  649. return res;
  650. }
  651. /**
  652. * 财务报表录入+修改
  653. *
  654. * @param orgFinance
  655. * @return
  656. */
  657. @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
  658. public Result disposeFinance(OrgFinance orgFinance) {
  659. Result res = new Result();
  660. if (null == orgFinance.getId()) {
  661. if (null == orgFinanceService.selectFinanceByUidAndYear(orgFinance.getUid(), orgFinance.getYear())) {
  662. orgFinance.setId(UUID.randomUUID().toString());
  663. orgFinance.setDeletedSign(0);
  664. orgFinanceService.insert(orgFinance);
  665. } else {
  666. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
  667. return res;
  668. }
  669. } else {
  670. orgFinanceService.updateByPrimaryKeySelective(orgFinance);
  671. }
  672. return res;
  673. }
  674. /**
  675. * 获取当前用户已录入项目标号列表
  676. *
  677. * @param uid
  678. * @return
  679. */
  680. @RequestMapping(value = "/activityNumber", method = RequestMethod.POST)
  681. public Result listActivityNumber(String uid) {
  682. Result res = new Result();
  683. List<ActivityNumberBo> activityNumberBo = orgActivityService.selectOrgActivityNumberBoByUid(uid);
  684. res.setData(activityNumberBo);
  685. return res;
  686. }
  687. /**
  688. * 科技成果转化情况列表入口
  689. *
  690. * @param pageNo
  691. * @param pageSize
  692. * @return
  693. */
  694. @RequestMapping(value = "/achievementList", method = RequestMethod.POST)
  695. public Result achievementList(String pageNo, String pageSize, String uid) {
  696. Result res = new Result();
  697. res = checkCertify(res, uid);
  698. if (res.getError().isEmpty()) {
  699. Integer pNo = 1;
  700. Integer pSize = 10;
  701. if (StringUtils.isNumeric(pageSize)) {
  702. pSize = Integer.parseInt(pageSize);
  703. }
  704. if (StringUtils.isNumeric(pageNo)) {
  705. pNo = Integer.parseInt(pageNo);
  706. }
  707. res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, uid));
  708. }
  709. return res;
  710. }
  711. /**
  712. * 科技成果转化情况新增+修改
  713. *
  714. * @param achievement
  715. * @return
  716. * @throws ParseException
  717. */
  718. @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
  719. public Result disposeAchievement(OrgTechAchievement achievement) throws ParseException {
  720. Result res = new Result();
  721. if (null == achievement.getId()) {
  722. achievement.setId(UUID.randomUUID().toString());
  723. achievement.setDeletedSign(0);
  724. orgTechAchievementService.inset(achievement);
  725. } else {
  726. orgTechAchievementService.updateByPrimaryKeySelective(achievement);
  727. }
  728. return res;
  729. }
  730. /**
  731. * 企业荣誉及其他证明材料列表入口
  732. *
  733. * @return
  734. */
  735. @RequestMapping(value = "/honorList", method = RequestMethod.POST)
  736. public Result honorList(String pageNo, String pageSize, String uid) {
  737. Result res = new Result();
  738. res = checkCertify(res, uid);
  739. if (res.getError().isEmpty()) {
  740. Integer pNo = 1;
  741. Integer pSize = 10;
  742. if (StringUtils.isNumeric(pageSize)) {
  743. pSize = Integer.parseInt(pageSize);
  744. }
  745. if (StringUtils.isNumeric(pageNo)) {
  746. pNo = Integer.parseInt(pageNo);
  747. }
  748. res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, uid));
  749. }
  750. return res;
  751. }
  752. /**
  753. * 企业荣誉及其他证明材料新增+修改
  754. *
  755. * @param achievement
  756. * @return
  757. * @throws ParseException
  758. */
  759. @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
  760. public Result disposeHonor(OrgHonorDatum honor, String issuingTimeFormattedDate, String uid) throws ParseException {
  761. Result res = new Result();
  762. if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
  763. honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, "yyyy-MM-dd"));
  764. }
  765. if (null == honor.getId()) {
  766. honor.setId(UUID.randomUUID().toString());
  767. honor.setUid(uid);
  768. honor.setDeletedSign(0);
  769. orgHonorDatumService.inset(honor);
  770. } else {
  771. orgHonorDatumService.updateByPrimaryKeySelective(honor);
  772. }
  773. return res;
  774. }
  775. /**
  776. * 技术中心入口
  777. *
  778. * @return
  779. */
  780. @RequestMapping(value = "/center", method = RequestMethod.POST)
  781. public Result center(String uid) {
  782. Result res = new Result();
  783. res = checkCertify(res, uid);
  784. if (res.getError().isEmpty()) {
  785. res.setData(orgTechCenterService.selectOrgTechCenterByUid(uid));
  786. }
  787. return res;
  788. }
  789. /**
  790. * 技术中心新增+修改
  791. *
  792. * @return
  793. * @throws ParseException
  794. */
  795. @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
  796. public Result disposeCenter(OrgTechCenter orgTechCenter, String foundingTimeFormattedDate, String uid)
  797. throws ParseException {
  798. Result res = new Result();
  799. if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
  800. orgTechCenter.setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, "yyyy-MM-dd"));
  801. }
  802. if (null == orgTechCenter.getId()) {
  803. orgTechCenter.setId(UUID.randomUUID().toString());
  804. orgTechCenter.setUid(uid);
  805. orgTechCenter.setDeletedSign(0);
  806. orgTechCenterService.insert(orgTechCenter);
  807. } else {
  808. orgTechCenterService.updateByPrimaryKeySelective(orgTechCenter);
  809. }
  810. return res;
  811. }
  812. /**
  813. * 获取公司联系人
  814. *
  815. * @return
  816. */
  817. @RequestMapping(value = "/getContacts", method = RequestMethod.POST)
  818. public Result getContacts(String uid) {
  819. Result res = new Result();
  820. OrganizationIdentity i = organizationIdentityService.selectOrgIdentityByUserId(uid);
  821. Map<String, String> map = new LinkedHashMap<String, String>();
  822. if (!StringUtils.isBlank(i.getFirstContacts()) && !StringUtils.isBlank(i.getFirstMobile())) {
  823. map.put(i.getFirstContacts(), i.getFirstMobile());
  824. }
  825. if (!StringUtils.isBlank(i.getSecondContacts()) && !StringUtils.isBlank(i.getSecondMobile())) {
  826. map.put(i.getSecondContacts(), i.getSecondMobile());
  827. }
  828. if (!StringUtils.isBlank(i.getThirdContacts()) && !StringUtils.isBlank(i.getThirdMobile())) {
  829. map.put(i.getThirdContacts(), i.getThirdMobile());
  830. }
  831. res.setData(map);
  832. return res;
  833. }
  834. /**
  835. * 申请高企认定
  836. *
  837. * @return
  838. */
  839. @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
  840. public Result applyCognizance(String contacts, String comment, String consultant, String uid, Integer year,
  841. Integer state) {
  842. Result res = new Result();
  843. if (null != orgCognizanceService.selectCognizanceByUidAndYear(year, uid)) {
  844. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度高企认定已申请!"));
  845. }
  846. OrgCognizance c = new OrgCognizance();
  847. c.setId(UUID.randomUUID().toString());
  848. c.setUid(uid);
  849. c.setContacts(contacts);
  850. c.setComment(comment);
  851. c.setConsultant(consultant);
  852. c.setYear(year);
  853. c.setDeletedSign(0);
  854. c.setState(state);
  855. Calendar now = Calendar.getInstance();
  856. now.set(Calendar.MILLISECOND, 0);
  857. c.setRecordTime(now.getTime());
  858. orgCognizanceService.insert(c);
  859. OrgCognizanceLog log = new OrgCognizanceLog();
  860. log.setId(UUID.randomUUID().toString());
  861. log.setCid(c.getId());
  862. log.setRecordTime(c.getCreateTime());
  863. log.setState(state);
  864. log.setComment(comment);
  865. log.setPrincipal(userService.selectByPrimaryKey(uid).getAid());
  866. log.setOperator(TokenManager.getAdminId());
  867. orgCognizanceLogService.insert(log);
  868. return res;
  869. }
  870. /**
  871. * 高企认定列表入口
  872. *
  873. * @param locationProvince
  874. * @param unitName
  875. * @return
  876. */
  877. @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
  878. public Result listCognizance(String uid, String locationProvince, String pageNo, String pageSize) {
  879. Result res = new Result();
  880. Integer pNo = 1;
  881. Integer pSize = 10;
  882. if (StringUtils.isNumeric(pageSize)) {
  883. pSize = Integer.parseInt(pageSize);
  884. }
  885. if (StringUtils.isNumeric(pageNo)) {
  886. pNo = Integer.parseInt(pageNo);
  887. }
  888. res.setData(orgCognizanceService.listCognizance(uid, locationProvince, pNo, pSize));
  889. return res;
  890. }
  891. /**
  892. * 高企认定流转状态
  893. *
  894. * @param cid
  895. * @return
  896. */
  897. @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
  898. public Result cognizanceLog(String cid) {
  899. Result res = new Result();
  900. List<OrgCognizanceLog> list = orgCognizanceLogService.selectOrgCognizanceLogByCid(cid);
  901. res.setData(list);
  902. return res;
  903. }
  904. /**
  905. * 高企认定详情入口
  906. *
  907. * @param uid
  908. * @param cid
  909. * @return
  910. */
  911. @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
  912. public Result cognizanceDetail(String uid, String cid, Integer year) {
  913. Result res = new Result();
  914. res.setData(handleCognizanceDetail(uid, cid, year));
  915. return res;
  916. }
  917. /**
  918. * 保存高企认定详情
  919. *
  920. * @throws ParseException
  921. */
  922. @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
  923. public Result disposeCognizanceDetail(OrgCognizance cog, OrgCognizanceLog log, String recordTimeFormattedDate)
  924. throws ParseException {
  925. Result res = new Result();
  926. if (null != log.getState()) {
  927. cog.setState(log.getState());
  928. switch (log.getState()) {
  929. case 1:
  930. cog.setCreateTime(log.getRecordTime());
  931. break;
  932. case 2:
  933. cog.setAcceptDate(log.getRecordTime());
  934. break;
  935. case 5:
  936. cog.setIssuingDate(log.getRecordTime());
  937. break;
  938. }
  939. cog.setConsultant(null == log.getOperator() ? "" : log.getOperator());
  940. log.setId(UUID.randomUUID().toString());
  941. log.setCid(cog.getId());
  942. log.setOperator(TokenManager.getAdminId());
  943. if (!StringUtils.isBlank(recordTimeFormattedDate)) {
  944. log.setRecordTime(DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd"));
  945. }
  946. orgCognizanceLogService.insert(log);
  947. }
  948. orgCognizanceService.updateByPrimaryKeySelective(cog);
  949. return res;
  950. }
  951. /**
  952. * 刪除高企认定
  953. * @param ids
  954. * @return
  955. */
  956. @RequestMapping(value = "/deleteCognizance", method = RequestMethod.POST)
  957. public Result deleteAnnualReport(@RequestParam(name = "ids[]", required = true) String[] ids) {
  958. Result res = new Result();
  959. List<String> id = new ArrayList<String>();
  960. for (String s : ids) {
  961. id.add(s);
  962. }
  963. res.setData(orgCognizanceService.batchDeleteByPrimaryKey(id));
  964. return res;
  965. }
  966. /**
  967. * 企业创新能力入口
  968. *
  969. * @param uid
  970. * @return
  971. */
  972. @RequestMapping(value = "/able", method = RequestMethod.POST)
  973. public Result able(String uid) {
  974. Result res = new Result();
  975. res.setData(userAbilityService.selectUserAbilityByUserId(uid));
  976. return res;
  977. }
  978. /**
  979. * 企业创新能力新增+保存
  980. *
  981. * @param u
  982. * @return
  983. */
  984. @RequestMapping(value = "/disposeAble", method = RequestMethod.POST)
  985. public Result disposeAble(UserAbility u) {
  986. Result res = new Result();
  987. if (null == u.getId()) {
  988. u.setId(UUID.randomUUID().toString());
  989. userAbilityService.insert(u);
  990. } else {
  991. userAbilityService.updateByPrimaryKeySelective(u);
  992. }
  993. return res;
  994. }
  995. /**
  996. * 年报列表
  997. *
  998. * @return
  999. */
  1000. @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
  1001. public Result annualReport(String uid, Integer year, Integer state, String pageSize, String pageNo) {
  1002. Result res = new Result();
  1003. res = checkCertify(res, uid);
  1004. if (res.getError().isEmpty()) {
  1005. Integer pNo = 1;
  1006. Integer pSize = 10;
  1007. if (StringUtils.isNumeric(pageSize)) {
  1008. pSize = Integer.parseInt(pageSize);
  1009. }
  1010. if (StringUtils.isNumeric(pageNo)) {
  1011. pNo = Integer.parseInt(pageNo);
  1012. }
  1013. res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, uid));
  1014. }
  1015. return res;
  1016. }
  1017. /**
  1018. * 企业年报详情
  1019. *
  1020. * @param uid
  1021. * @param year
  1022. * @return
  1023. */
  1024. @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
  1025. public Result annualReportDetail(String uid, Integer year) {
  1026. Result res = new Result();
  1027. res.setData(handleAnnualReport(uid, year));
  1028. return res;
  1029. }
  1030. /**
  1031. * 高企年报新增+修改
  1032. *
  1033. * @param orgAnnualReport
  1034. * @return
  1035. */
  1036. @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
  1037. public Result disposeAnnualReport(OrgAnnualReport orgAnnualReport) {
  1038. Result res = new Result();
  1039. if (null == orgAnnualReport.getId()) {
  1040. if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(orgAnnualReport.getYear(),
  1041. orgAnnualReport.getUid())) {
  1042. res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
  1043. return res;
  1044. } else {
  1045. orgAnnualReport.setId(UUID.randomUUID().toString());
  1046. Calendar now = Calendar.getInstance();
  1047. now.set(Calendar.MILLISECOND, 0);
  1048. orgAnnualReport.setCreateTime(now.getTime());
  1049. orgAnnualReport.setLastUpdateTime(orgAnnualReport.getCreateTime());
  1050. orgAnnualReport.setDeletedSign(0);
  1051. orgAnnualReportService.insert(orgAnnualReport);
  1052. }
  1053. } else {
  1054. Calendar now = Calendar.getInstance();
  1055. now.set(Calendar.MILLISECOND, 0);
  1056. orgAnnualReport.setLastUpdateTime(now.getTime());
  1057. orgAnnualReportService.updateByPrimaryKeySelective(orgAnnualReport);
  1058. }
  1059. return res;
  1060. }
  1061. /**
  1062. * 上传相关模版
  1063. *
  1064. * @param req
  1065. * @return
  1066. */
  1067. @RequestMapping(value = "/uploadTemplate", method = RequestMethod.POST)
  1068. public Result uploadPatentTemplate(HttpServletRequest req, String sign) {
  1069. Result res = new Result();
  1070. System.out.println("init");
  1071. String fileName = "";
  1072. List<MultipartFile> files = getFiles(req);
  1073. MultipartFile mf = files.get(0);
  1074. String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
  1075. System.err.println("suffix" + " " + suffix);
  1076. if (suffix.equals(".doc") || suffix.equals(".docx")) {
  1077. if ("patent_prory_statement".equals(sign)) {
  1078. fileName = "patent_prory_statement" + suffix;
  1079. } else {
  1080. fileName = System.nanoTime() + "";
  1081. }
  1082. String name = handleFile(res, req, fileName, files, mf);
  1083. res.setData(name);
  1084. System.out.println(name);
  1085. if (res.getData() != "" && res.getData() != null && null == aftFileService.selectAftFileBySign(sign)) {
  1086. AftFile f = new AftFile();
  1087. f.setId(UUID.randomUUID().toString());
  1088. if ("patent_prory_statement".equals(sign)) {
  1089. f.setFileName("专利代理委托书模版");
  1090. f.setSign(sign);
  1091. }
  1092. f.setFilePath("/admin/" + fileName);
  1093. f.setDeleletedSign(0);
  1094. aftFileService.insert(f);
  1095. }
  1096. } else {
  1097. res.getError().add(buildError(ErrorConstants.FILE_PATTERN_ERROR, "文件格式错误,请重新上传!"));
  1098. }
  1099. return res;
  1100. }
  1101. /**
  1102. *
  1103. * @return
  1104. */
  1105. // 判断用户是否通过认证
  1106. private Result checkCertify(Result res, String uid) {
  1107. OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(uid);
  1108. if (null == o || 5 != o.getAuditStatus()) {
  1109. res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
  1110. }
  1111. return res;
  1112. }
  1113. // org团体列表
  1114. private Pagination<OrgListBo> getOrgList(String mobile, String email, String[] createTime, Integer number,
  1115. String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
  1116. return userService.listOrg(mobile, email, createTime, number, aftUsername, auditStatus,
  1117. pNo, pSize);
  1118. }
  1119. // user个人列表
  1120. private Pagination<UserListBo> getUserList(String mobile, String email, String[] createTime, Integer number,
  1121. String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
  1122. return userService.listUser(mobile, email, createTime, number, aftUsername,
  1123. auditStatus, pNo, pSize);
  1124. }
  1125. private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
  1126. CognizanceDetailBo cog = new CognizanceDetailBo();
  1127. CognizanceOrgInfoBo orgInfo = orgCognizanceService.selectCognizanceOrgInfoBoByUidAndCid(uid, cid);
  1128. cog.setUid(null == orgInfo.getUid() ? "" : orgInfo.getUid());
  1129. cog.setCid(null == orgInfo.getCid() ? "" : orgInfo.getCid());
  1130. cog.setUnitName(null == orgInfo.getUnitName() ? "" : orgInfo.getUnitName());
  1131. cog.setOrgCode(null == orgInfo.getOrgCode() ? "" : orgInfo.getOrgCode());
  1132. cog.setPostalAddress(null == orgInfo.getPostalAddress() ? "" : orgInfo.getPostalAddress());
  1133. cog.setContacts(null == orgInfo.getContacts() ? "" : orgInfo.getContacts());
  1134. cog.setTechnicalField1(null == orgInfo.getTechnicalField1() ? 0 : orgInfo.getTechnicalField1());
  1135. cog.setTechnicalField2(null == orgInfo.getTechnicalField2() ? 0 : orgInfo.getTechnicalField2());
  1136. cog.setTechnicalField3(null == orgInfo.getTechnicalField3() ? 0 : orgInfo.getTechnicalField3());
  1137. cog.setBasicResearchCost(
  1138. null == orgInfo.getBasicResearchCost() ? new BigDecimal(0) : orgInfo.getBasicResearchCost());
  1139. cog.setAccident(null == orgInfo.getAccient() ? 0 : orgInfo.getAccient());
  1140. CognizanceResearchCostBo researchCost = orgCognizanceService.selectCognizanceResearchCostBoByUidAndYear(year,
  1141. uid);
  1142. cog.setResearchCost(
  1143. null == researchCost.getResearchCost() ? new BigDecimal(0) : researchCost.getResearchCost());
  1144. cog.setTerritory(null == researchCost.getTerritory() ? new BigDecimal(0) : researchCost.getTerritory());
  1145. CognizanceManageCostBo manageCost = orgCognizanceService.selectCognizanceManageCostBoByUidAndYear(year, uid);
  1146. cog.setNetAsset1(null == manageCost.getNetAsset1() ? new BigDecimal(0) : manageCost.getNetAsset1());
  1147. cog.setNetAsset2(null == manageCost.getNetAsset2() ? new BigDecimal(0) : manageCost.getNetAsset2());
  1148. cog.setNetAsset3(null == manageCost.getNetAsset3() ? new BigDecimal(0) : manageCost.getNetAsset3());
  1149. cog.setSalesRevenue1(null == manageCost.getSalesRevenue1() ? new BigDecimal(0) : manageCost.getSalesRevenue1());
  1150. cog.setSalesRevenue2(null == manageCost.getSalesRevenue2() ? new BigDecimal(0) : manageCost.getSalesRevenue2());
  1151. cog.setSalesRevenue3(null == manageCost.getSalesRevenue3() ? new BigDecimal(0) : manageCost.getSalesRevenue3());
  1152. cog.setGrossProfit1(null == manageCost.getGrossProfit1() ? new BigDecimal(0) : manageCost.getGrossProfit1());
  1153. cog.setGrossProfit2(null == manageCost.getGrossProfit2() ? new BigDecimal(0) : manageCost.getGrossProfit2());
  1154. cog.setGrossProfit3(null == manageCost.getGrossProfit3() ? new BigDecimal(0) : manageCost.getGrossProfit3());
  1155. CognizanceCatagoryBo catagory = orgCognizanceService.selectCognizanceCatagoryBoByUidAndYear(year, uid);
  1156. cog.setFirstCatagory(null == catagory.getFirstCatagory() ? 0 : catagory.getFirstCatagory());
  1157. cog.setSecondCatagory(null == catagory.getSecondCatagory() ? 0 : catagory.getSecondCatagory());
  1158. cog.setFirmTotal(null == catagory.getFirmTotal() ? 0 : catagory.getFirmTotal());
  1159. cog.setTechTotal(null == catagory.getTechTotal() ? 0 : catagory.getTechTotal());
  1160. cog.setTotalRevenue(null == catagory.getTotalRevenue() ? new BigDecimal(0) : catagory.getTotalRevenue());
  1161. BigDecimal revenue = orgCognizanceService.selectLastYearRevenueByUidAndYear(year, uid);
  1162. cog.setLastYearRevenue(null == revenue ? new BigDecimal(0) : revenue);
  1163. return cog;
  1164. }
  1165. private AnnualReportBo handleAnnualReport(String uid, Integer year) {
  1166. AnnualReportBo report = new AnnualReportBo();
  1167. AnnualReportPropertyRightBo p = orgAnnualReportService.selectAnnualReportPropertyRightBoByYearAndUid(year, uid);
  1168. report.setInventionPatent(null == p.getInventionPatent() ? 0 : p.getInventionPatent());
  1169. report.setDefensePatent(null == p.getDefensePatent() ? 0 : p.getDefensePatent());
  1170. report.setNationalCrop(null == p.getNationalCrop() ? 0 : p.getNationalCrop());
  1171. report.setNewPlantCariety(null == p.getNewPlantCariety() ? 0 : p.getNewPlantCariety());
  1172. report.setNationalDrug(null == p.getNationalDrug() ? 0 : p.getNationalDrug());
  1173. report.setChineseMedicine(null == p.getChineseMedicine() ? 0 : p.getChineseMedicine());
  1174. report.setUtilityPatent(null == p.getUtilityPatent() ? 0 : p.getUtilityPatent());
  1175. report.setCircuitDesign(null == p.getCircuitDesign() ? 0 : p.getCircuitDesign());
  1176. report.setExteriorPatent(null == p.getExteriorPatent() ? 0 : p.getExteriorPatent());
  1177. report.setSoftwareWorks(null == p.getSoftwareWorks() ? 0 : p.getSoftwareWorks());
  1178. BigDecimal t = orgAnnualReportService.selectAnnualReportTerritoryByYearAndUid(year, uid);
  1179. report.setTerritory(null == t ? new BigDecimal(0) : t);
  1180. AnnualReportMainBo m = orgAnnualReportService.selectAnnualReportMainBoByYearAndUid(year, uid);
  1181. report.setUid(m.getUid());
  1182. report.setUnitName(m.getUnitName());
  1183. report.setOrgCode(m.getOrgCode());
  1184. report.setLocationProvince(m.getLocationProvince());
  1185. report.setLocationCity(m.getLocationCity());
  1186. report.setLocationArea(m.getLocationArea());
  1187. report.setListed(m.getListed().toString());
  1188. if (null != m.getListedDate()) {
  1189. report.setListedDate(DateFormatUtils.format(m.getListedDate(), "yyyy-MM-dd"));
  1190. }
  1191. report.setListedType(m.getListedType().toString());
  1192. report.setStockCode(m.getStockCode());
  1193. report.setFirmTotal(null == m.getFirmTotal() ? 0 : m.getFirmTotal());
  1194. report.setTechTotal(null == m.getTechTotal() ? 0 : m.getTechTotal());
  1195. report.setNewEmployment(null == m.getNewEmployment() ? 0 : m.getNewEmployment());
  1196. report.setGraduateNumber(null == m.getGraduateNumber() ? 0 : m.getGraduateNumber());
  1197. report.setSalesRevenue(null == m.getSalesRevenue() ? new BigDecimal(0) : m.getSalesRevenue());
  1198. report.setGrossProfit(null == m.getGrossProfit() ? new BigDecimal(0) : m.getGrossProfit());
  1199. report.setNetAsset(null == m.getNetAsset() ? new BigDecimal(0) : m.getNetAsset());
  1200. report.setCertificateNumber(m.getCertificateNumber());
  1201. if (null != m.getIssuingDate()) {
  1202. report.setIssuingDate(DateFormatUtils.format(m.getIssuingDate(), "yyyy-MM-dd"));
  1203. }
  1204. report.setContacts(m.getContacts());
  1205. report.setResearchCost(null == m.getResearchCost() ? new BigDecimal(0) : m.getResearchCost());
  1206. report.setTotalRevenue(null == m.getTotalRevenue() ? new BigDecimal(0) : m.getTotalRevenue());
  1207. report.setLastYearRevenue(null == m.getLastYearRevenue() ? new BigDecimal(0) : m.getLastYearRevenue());
  1208. return report;
  1209. }
  1210. private String handleFile(Result res, HttpServletRequest req, String fileName, List<MultipartFile> files,
  1211. MultipartFile mf) {
  1212. if (!files.isEmpty()) {
  1213. try {
  1214. mf.transferTo(toAdminPrivateFile(fileName));
  1215. LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
  1216. } catch (IllegalStateException | IOException e) {
  1217. LoggerUtils.error(getClass(), "文件上传失败", e);
  1218. res.getError().add(buildError("", "文件上传失败!"));
  1219. return "";
  1220. }
  1221. } else {
  1222. res.getError().add(buildError("", "文件上传失败!"));
  1223. return "";
  1224. }
  1225. return fileName;
  1226. }
  1227. }