OrgIntellectualPropertyServiceImpl.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package com.goafanti.cognizance.service.impl;
  2. import java.text.ParseException;
  3. import java.util.Date;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7. import org.apache.commons.lang3.StringUtils;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Service;
  10. import com.goafanti.cognizance.bo.AnnualReportPropertyRightBo;
  11. import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
  12. import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
  13. import com.goafanti.common.constant.AFTConstants;
  14. import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
  15. import com.goafanti.common.model.OrgIntellectualProperty;
  16. import com.goafanti.common.utils.DateUtils;
  17. import com.goafanti.core.mybatis.BaseMybatisDao;
  18. import com.goafanti.core.mybatis.page.Pagination;
  19. @Service
  20. public class OrgIntellectualPropertyServiceImpl extends BaseMybatisDao<OrgIntellectualPropertyMapper>
  21. implements OrgIntellectualPropertyService {
  22. @Autowired
  23. private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
  24. @Override
  25. public OrgIntellectualProperty insert(OrgIntellectualProperty orgIntellectualProperty) {
  26. orgIntellectualPropertyMapper.insert(orgIntellectualProperty);
  27. return orgIntellectualProperty;
  28. }
  29. @SuppressWarnings("unchecked")
  30. @Override
  31. public Pagination<OrgIntellectualProperty> listIntellectual(Integer pageNo, Integer pageSize, String uid,
  32. String startDate, String endDate) {
  33. Map<String, Object> params = new HashMap<>();
  34. Date sDate = null;
  35. Date eDate = null;
  36. if (!StringUtils.isBlank(uid)){
  37. params.put("uid", uid);
  38. }
  39. if (!StringUtils.isBlank(startDate)){
  40. try {
  41. sDate = DateUtils.parseDate(startDate, AFTConstants.YYYYMMDD);
  42. } catch (ParseException e) {
  43. }
  44. }
  45. if (!StringUtils.isBlank(endDate)){
  46. try {
  47. eDate = DateUtils.addDays(DateUtils.parseDate(endDate, AFTConstants.YYYYMMDD),1);
  48. } catch (ParseException e) {
  49. }
  50. }
  51. if (null != sDate){
  52. params.put("sDate", sDate);
  53. }
  54. if (null != eDate){
  55. params.put("eDate", eDate);
  56. }
  57. if (pageNo == null || pageNo < 0) {
  58. pageNo = 1;
  59. }
  60. if (pageSize == null || pageSize < 0) {
  61. pageSize = 10;
  62. }
  63. return (Pagination<OrgIntellectualProperty>) findPage("findOrgIntellectualPropertyListByPage",
  64. "findOrgIntellectualPropertyCount", params, pageNo, pageSize);
  65. }
  66. @Override
  67. public int delete(String id) {
  68. return orgIntellectualPropertyMapper.deleteByPrimaryKey(id);
  69. }
  70. @Override
  71. public int deleteByPrimaryKey(List<String> id) {
  72. return orgIntellectualPropertyMapper.batchDeleteByPrimaryKey(id);
  73. }
  74. @Override
  75. public int updateByPrimaryKeySelective(OrgIntellectualProperty orgIntellectualProperty) {
  76. return orgIntellectualPropertyMapper.updateByPrimaryKeySelective(orgIntellectualProperty);
  77. }
  78. @Override
  79. public OrgIntellectualProperty selectOrgIntellectualPropertyByPid(String pid) {
  80. return orgIntellectualPropertyMapper.selectOrgIntellectualPropertyByPid(pid);
  81. }
  82. @Override
  83. public OrgIntellectualProperty selectByPrimaryKey(String id) {
  84. return orgIntellectualPropertyMapper.selectByPrimaryKey(id);
  85. }
  86. @Override
  87. public OrgIntellectualPropertyDetailBo selectPatentTypeDetail(String id) {
  88. return orgIntellectualPropertyMapper.selectPatentTypeDetail(id);
  89. }
  90. @Override
  91. public OrgIntellectualPropertyDetailBo selectCopyrightTypeDetail(String id) {
  92. return orgIntellectualPropertyMapper.selectCopyrightTypeDetail(id);
  93. }
  94. @Override
  95. public AnnualReportPropertyRightBo selectIntellectualPropertyCount(Integer year, String uid) {
  96. AnnualReportPropertyRightBo p = orgIntellectualPropertyMapper.selectIntellectualPropertyCount(year, uid);
  97. if (null != p) {
  98. p.setInventionPatent(null == p.getInventionPatent() ? 0 : p.getInventionPatent());
  99. p.setDefensePatent(null == p.getDefensePatent() ? 0 : p.getDefensePatent());
  100. p.setNationalCrop(null == p.getNationalCrop() ? 0 : p.getNationalCrop());
  101. p.setNewPlantCariety(null == p.getNewPlantCariety() ? 0 : p.getNewPlantCariety());
  102. p.setNationalDrug(null == p.getNationalDrug() ? 0 : p.getNationalDrug());
  103. p.setChineseMedicine(null == p.getChineseMedicine() ? 0 : p.getChineseMedicine());
  104. p.setUtilityPatent(null == p.getUtilityPatent() ? 0 : p.getUtilityPatent());
  105. p.setCircuitDesign(null == p.getCircuitDesign() ? 0 : p.getCircuitDesign());
  106. p.setExteriorPatent(null == p.getExteriorPatent() ? 0 : p.getExteriorPatent());
  107. p.setSoftwareWorks(null == p.getSoftwareWorks() ? 0 : p.getSoftwareWorks());
  108. }
  109. return p;
  110. }
  111. @Override
  112. public List<OrgIntellectualProperty> selectIntellectualPropertyList(Integer year, String uid) {
  113. return orgIntellectualPropertyMapper.selectIntellectualPropertyList(year, uid);
  114. }
  115. }