| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- package com.goafanti.sc.service.impl;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.UUID;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.common.dao.ScAchievementMapper;
- import com.goafanti.common.dao.ScDemandMapper;
- import com.goafanti.common.dao.ScOrganizationMapper;
- import com.goafanti.common.dao.ScPublisherMapper;
- import com.goafanti.common.model.ScAchievement;
- import com.goafanti.common.model.ScDemand;
- import com.goafanti.common.model.ScOrganization;
- import com.goafanti.common.model.ScPublisher;
- 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.sc.bo.ScAchievementListBo;
- import com.goafanti.sc.bo.ScDemandListBo;
- import com.goafanti.sc.bo.inputAchievement;
- import com.goafanti.sc.bo.inputDemands;
- import com.goafanti.sc.service.ScAchievementService;
- import com.goafanti.sc.service.ScDemandService;
- @Service
- public class ScDmandServiceImpl extends BaseMybatisDao<ScDemandMapper> implements ScDemandService {
-
- @Autowired
- private ScDemandMapper scDemandMapper;
- @Autowired
- private ScPublisherMapper scPublisherMapper;
- @Autowired
- private ScOrganizationMapper scOrganizationMapper;
-
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<ScDemandListBo> DemandList(String reserveButtUnit, String type, String name,String orgName, Integer pSize, Integer pNo) {
- Map<String, Object> params =new HashMap<>();
- if (pNo == null || pNo < 0) pNo = 1;
- if (pSize == null || pSize < 0 || pSize > 10) pSize = 10;
- if(StringUtils.isNotBlank(name))params.put("name", name);
- if(StringUtils.isNotBlank(orgName))params.put("orgName", orgName);
- if(StringUtils.isNotBlank(reserveButtUnit))params.put("reserveButtUnit", reserveButtUnit);
- if(StringUtils.isNotBlank(type))params.put("type", type);
- Pagination<ScDemandListBo> p= (Pagination<ScDemandListBo>) findPage("findDemandListByPage",
- "findDemandCount",params,
- pNo, pSize);
- List<ScDemandListBo> l=(List<ScDemandListBo>) p.getList();
- for (ScDemandListBo s : l) {
- if(s!=null&&s.getIndustry()!=null){
- if (s.getIndustry().equals("0")) {
- s.setIndustry( "先进制造与自动化");
- }if (s.getIndustry().equals("1")) {
- s.setIndustry( "电子信息技术");
- }if (s.getIndustry().equals("2")) {
- s.setIndustry( "新材料技术");
- }if (s.getIndustry().equals("3")) {
- s.setIndustry( "生物与新药");
- }if (s.getIndustry().equals("4")) {
- s.setIndustry( "资源与环境");
- }if (s.getIndustry().equals("5")) {
- s.setIndustry( "新能源");
- }
- }
- }
- return p;
- }
- @Override
- public int delectDemand(String id) {
- ScDemand s=new ScDemand();
- s.setId(id);
- s.setDeleteSign(1);
- return scDemandMapper.updateByPrimaryKeySelective(s);
- }
- @Override
- public int updateDemand(inputDemands a) {
- scDemandMapper.updateByPrimaryKeySelective(a);
- ScDemand d=scDemandMapper.selectByPrimaryKey(a.getId());
- ScPublisher s=new ScPublisher();
- ScOrganization o= new ScOrganization();
- s.setId(d.getPublisherId());
- if(null!=a.getTelephone())s.setTelephone(a.getTelephone());
- if(null!=a.getEmail())s.setEmail(a.getEmail());
- if(null!=a.getZipCode())s.setZipCode(a.getZipCode());
- if(null!=a.getPublisherName())s.setContacts(a.getPublisherName());
- if(null!=a.getProvince())s.setProvince(Integer.valueOf(a.getProvince()));
- if(null!=a.getPintroduce())s.setIntroduce(a.getPintroduce());
- if(null!=a.getRemarks())s.setRemarks(a.getRemarks());
- if(null!=a.getPname())s.setName(a.getPname());
- if(null!=a.getCity())s.setCity(Integer.valueOf(a.getCity()));
- if(null!=a.getAddress())s.setAddress(a.getAddress());
- scPublisherMapper.updateByPrimaryKeySelective(s);
- o.setPublisherId(d.getPublisherId());
- if(null!=a.getFeature())o.setFeature(a.getFeature());
- if(null!=a.getNature())o.setNature(a.getNature());
- if(null!=a.getLegalPerson())o.setLegalPerson(a.getLegalPerson());
- if(null!=a.getWebsite())o.setWebsite(a.getWebsite());
- scOrganizationMapper.updateBypublisherId(o);
- return 1;
- }
- @Override
- public inputDemands demandDetails(String id) {
-
- return scDemandMapper.selectById(id);
- }
- @Override
- public int addDemands(inputDemands a) {
- ScPublisher s=new ScPublisher();
- ScOrganization o= new ScOrganization();
- String pid=UUID.randomUUID().toString();
- a.setId(UUID.randomUUID().toString());
- a.setPublisherId(pid);
- scDemandMapper.insertSelective(a);
- s.setId(pid);
- if(StringUtils.isNotBlank(a.getTelephone()))s.setTelephone(a.getTelephone());
- if(StringUtils.isNotBlank(a.getEmail()))s.setEmail(a.getEmail());
- if(StringUtils.isNotBlank(a.getZipCode()))s.setZipCode(a.getZipCode());
- if(StringUtils.isNotBlank(a.getPublisherName()))s.setContacts(a.getPublisherName());
- if(null!=a.getProvince()&&!a.getProvince().equals(""))s.setProvince(Integer.valueOf(a.getProvince()));
- if(StringUtils.isNotBlank(a.getPintroduce()))s.setIntroduce(a.getPintroduce());
- if(StringUtils.isNotBlank(a.getRemarks()))s.setRemarks(a.getRemarks());
- if(StringUtils.isNotBlank(a.getPname()))s.setName(a.getPname());
- if(null!=a.getCity()&&!a.getCity().equals(""))s.setCity(Integer.valueOf(a.getCity()));
- if(StringUtils.isNotBlank(a.getAddress()))s.setAddress(a.getAddress());
- scPublisherMapper.insertSelective(s);
- o.setId(UUID.randomUUID().toString());
- o.setPublisherId(pid);
- if(StringUtils.isNotBlank(a.getFeature()))o.setFeature(a.getFeature());
- if(StringUtils.isNotBlank(a.getNature()))o.setNature(a.getNature());
- if(StringUtils.isNotBlank(a.getLegalPerson()))o.setLegalPerson(a.getLegalPerson());
- if(StringUtils.isNotBlank(a.getWebsite()))o.setWebsite(a.getWebsite());
- scOrganizationMapper.insertSelective(o);
- return 1;
- }
-
-
-
-
- }
|