| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- package com.goafanti.patent.service.impl;
- import java.text.ParseException;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.dao.PatentCostMapper;
- import com.goafanti.common.model.PatentCost;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.patent.bo.PatentApplicationFeeBo;
- import com.goafanti.patent.service.PatentCostService;
- @Service
- public class PatentCostServiceImpl extends BaseMybatisDao<PatentCostMapper> implements PatentCostService {
- @Autowired
- private PatentCostMapper patentCostMapper;
- @Override
- public int updateByPrimaryKeySelective(PatentCost patentCost) {
- return patentCostMapper.updateByPrimaryKeySelective(patentCost);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<PatentApplicationFeeBo> getApplicationFeeList(String[] pDate, Integer locationProvince,
- Integer pageNo, Integer pageSize) throws ParseException {
- Map<String, Object> params = new HashMap<>();
- Date pStart = null;
- Date pEnd = null;
- if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
- params.put("principal", TokenManager.getAdminId());
- }
- if (pDate != null && pDate.length > 0) {
- pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
- pEnd = StringUtils.isBlank(pDate[1]) ? null
- : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
- }
- if (pStart != null) {
- params.put("pStart", pStart);
- }
- if (pEnd != null) {
- params.put("pEnd", pEnd);
- }
- if (null != locationProvince) {
- params.put("locationProvince", locationProvince);
- }
- if (pageNo == null || pageNo < 0) {
- pageNo = 1;
- }
- if (pageSize == null || pageSize < 0 || pageSize > 1000) {
- pageSize = 10;
- }
- return (Pagination<PatentApplicationFeeBo>) findPage("findApplicationFeeListByPage", "findApplicationFeeCount",
- params, pageNo, pageSize);
- }
- @Override
- public PatentCost insert(PatentCost patentCost) {
- patentCostMapper.insert(patentCost);
- return patentCost;
- }
- @Override
- public PatentCost selectByPrimaryKey(String id) {
- return patentCostMapper.selectByPrimaryKey(id);
- }
- @Override
- public int batchUpdateByPrimaryKey(List<PatentCost> list) {
- return patentCostMapper.batchUpdateByPrimaryKey(list);
- }
- }
|