| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- package com.goafanti.cognizance.service.impl;
- import java.text.ParseException;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.cognizance.bo.AnnualReportPropertyRightBo;
- import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
- import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
- import com.goafanti.common.model.OrgIntellectualProperty;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- @Service
- public class OrgIntellectualPropertyServiceImpl extends BaseMybatisDao<OrgIntellectualPropertyMapper>
- implements OrgIntellectualPropertyService {
- @Autowired
- private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
- @Override
- public OrgIntellectualProperty insert(OrgIntellectualProperty orgIntellectualProperty) {
- orgIntellectualPropertyMapper.insert(orgIntellectualProperty);
- return orgIntellectualProperty;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<OrgIntellectualProperty> listIntellectual(Integer pageNo, Integer pageSize, String uid,
- String startDate, String endDate) {
- Map<String, Object> params = new HashMap<>();
- Date sDate = null;
- Date eDate = null;
- if (!StringUtils.isBlank(uid)){
- params.put("uid", uid);
- }
-
- if (!StringUtils.isBlank(startDate)){
- try {
- sDate = DateUtils.parseDate(startDate, AFTConstants.YYYYMMDD);
- } catch (ParseException e) {
- }
- }
-
- if (!StringUtils.isBlank(endDate)){
- try {
- eDate = DateUtils.addDays(DateUtils.parseDate(endDate, AFTConstants.YYYYMMDD),1);
- } catch (ParseException e) {
- }
- }
-
- if (null != sDate){
- params.put("sDate", sDate);
- }
-
- if (null != eDate){
- params.put("eDate", eDate);
- }
- if (pageNo == null || pageNo < 0) {
- pageNo = 1;
- }
- if (pageSize == null || pageSize < 0) {
- pageSize = 10;
- }
- return (Pagination<OrgIntellectualProperty>) findPage("findOrgIntellectualPropertyListByPage",
- "findOrgIntellectualPropertyCount", params, pageNo, pageSize);
- }
- @Override
- public int delete(String id) {
- return orgIntellectualPropertyMapper.deleteByPrimaryKey(id);
- }
- @Override
- public int deleteByPrimaryKey(List<String> id) {
- return orgIntellectualPropertyMapper.batchDeleteByPrimaryKey(id);
- }
- @Override
- public int updateByPrimaryKeySelective(OrgIntellectualProperty orgIntellectualProperty) {
- return orgIntellectualPropertyMapper.updateByPrimaryKeySelective(orgIntellectualProperty);
- }
- @Override
- public OrgIntellectualProperty selectOrgIntellectualPropertyByPid(String pid) {
- return orgIntellectualPropertyMapper.selectOrgIntellectualPropertyByPid(pid);
- }
- @Override
- public OrgIntellectualProperty selectByPrimaryKey(String id) {
- return orgIntellectualPropertyMapper.selectByPrimaryKey(id);
- }
- @Override
- public OrgIntellectualPropertyDetailBo selectPatentTypeDetail(String id) {
- return orgIntellectualPropertyMapper.selectPatentTypeDetail(id);
- }
- @Override
- public OrgIntellectualPropertyDetailBo selectCopyrightTypeDetail(String id) {
- return orgIntellectualPropertyMapper.selectCopyrightTypeDetail(id);
- }
- @Override
- public AnnualReportPropertyRightBo selectIntellectualPropertyCount(Integer year, String uid) {
- AnnualReportPropertyRightBo p = orgIntellectualPropertyMapper.selectIntellectualPropertyCount(year, uid);
- if (null != p) {
- p.setInventionPatent(null == p.getInventionPatent() ? 0 : p.getInventionPatent());
- p.setDefensePatent(null == p.getDefensePatent() ? 0 : p.getDefensePatent());
- p.setNationalCrop(null == p.getNationalCrop() ? 0 : p.getNationalCrop());
- p.setNewPlantCariety(null == p.getNewPlantCariety() ? 0 : p.getNewPlantCariety());
- p.setNationalDrug(null == p.getNationalDrug() ? 0 : p.getNationalDrug());
- p.setChineseMedicine(null == p.getChineseMedicine() ? 0 : p.getChineseMedicine());
- p.setUtilityPatent(null == p.getUtilityPatent() ? 0 : p.getUtilityPatent());
- p.setCircuitDesign(null == p.getCircuitDesign() ? 0 : p.getCircuitDesign());
- p.setExteriorPatent(null == p.getExteriorPatent() ? 0 : p.getExteriorPatent());
- p.setSoftwareWorks(null == p.getSoftwareWorks() ? 0 : p.getSoftwareWorks());
- }
- return p;
- }
- @Override
- public List<OrgIntellectualProperty> selectIntellectualPropertyList(Integer year, String uid) {
- return orgIntellectualPropertyMapper.selectIntellectualPropertyList(year, uid);
- }
- }
|