PatentCostServiceImpl.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.goafanti.patent.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.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Service;
  9. import com.goafanti.common.constant.AFTConstants;
  10. import com.goafanti.common.dao.PatentCostMapper;
  11. import com.goafanti.common.model.PatentCost;
  12. import com.goafanti.common.utils.DateUtils;
  13. import com.goafanti.common.utils.StringUtils;
  14. import com.goafanti.core.mybatis.BaseMybatisDao;
  15. import com.goafanti.core.mybatis.page.Pagination;
  16. import com.goafanti.core.shiro.token.TokenManager;
  17. import com.goafanti.patent.bo.PatentApplicationFeeBo;
  18. import com.goafanti.patent.service.PatentCostService;
  19. @Service
  20. public class PatentCostServiceImpl extends BaseMybatisDao<PatentCostMapper> implements PatentCostService {
  21. @Autowired
  22. private PatentCostMapper patentCostMapper;
  23. @Override
  24. public int updateByPrimaryKeySelective(PatentCost patentCost) {
  25. return patentCostMapper.updateByPrimaryKeySelective(patentCost);
  26. }
  27. @SuppressWarnings("unchecked")
  28. @Override
  29. public Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] pDate, Integer locationProvince,
  30. Integer pageNo, Integer pageSize) throws ParseException {
  31. Map<String, Object> params = new HashMap<>();
  32. Date pStart = null;
  33. Date pEnd = null;
  34. if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
  35. params.put("principal", TokenManager.getAdminId());
  36. }
  37. if (pDate != null && pDate.length > 0) {
  38. pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
  39. pEnd = StringUtils.isBlank(pDate[1]) ? null
  40. : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
  41. }
  42. if (pStart != null) {
  43. params.put("pStart", pStart);
  44. }
  45. if (pEnd != null) {
  46. params.put("pEnd", pEnd);
  47. }
  48. if (null != locationProvince) {
  49. params.put("locationProvince", locationProvince);
  50. }
  51. if (pageNo == null || pageNo < 0) {
  52. pageNo = 1;
  53. }
  54. if (pageSize == null || pageSize < 0 || pageSize > 1000) {
  55. pageSize = 10;
  56. }
  57. return (Pagination<PatentApplicationFeeBo>) findPage("findApplicationFeeListByPage", "findApplicationFeeCount",
  58. params, pageNo, pageSize);
  59. }
  60. @Override
  61. public PatentCost insert(PatentCost patentCost) {
  62. patentCostMapper.insert(patentCost);
  63. return patentCost;
  64. }
  65. @Override
  66. public PatentCost selectByPrimaryKey(String id) {
  67. return patentCostMapper.selectByPrimaryKey(id);
  68. }
  69. @Override
  70. public int batchUpdateByPrimaryKey(List<PatentCost> list) {
  71. return patentCostMapper.batchUpdateByPrimaryKey(list);
  72. }
  73. }