| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package com.goafanti.demand.service.impl;
- import java.util.Date;
- 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.bo.PublishPageBo;
- import com.goafanti.common.dao.DemandPublishMapper;
- import com.goafanti.common.model.DemandPublish;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.demand.bo.DemandPublishBo;
- import com.goafanti.demand.service.DemandPublishPageService;
- import com.goafanti.demand.service.DemandPublishService;
- @Service
- public class DemandPublishServiceImpl extends BaseMybatisDao<DemandPublishMapper> implements DemandPublishService {
- @Autowired
- private DemandPublishMapper demandPublishMapper;
- @Override
- public int insertDemandPublish(DemandPublish d) {
- String [] did=d.getDemandId().split(",");
- for (String s : did) {
- d.setDemandId(s);
- if (demandPublishMapper.checkExisting(d)>0) {
- continue;
- }
- d.setId(UUID.randomUUID().toString());
- if (null!=TokenManager.getAdminId()) {
- d.setPublisher(TokenManager.getAdminId());
- }
- if (null==d.getShowNumber()) {
- d.setShowNumber(9999999);
- }
- if (null==d.getTopNumber()) {
- d.setTopNumber(9999999);
- }
- d.setPublishTime(new Date());
- demandPublishMapper.insertSelective(d);
- }
- return 1;
- }
- @Override
- public int deletePublish(String id) {
- return demandPublishMapper.deleteByPrimaryKey(id);
- }
- @Override
- public int updatePublish(DemandPublish d) {
- DemandPublish d1=demandPublishMapper.selectByPrimaryKey(d.getId());
- if (d1.getIfTop()!=d.getIfTop()&&d.getIfTop()==1) {
- d.setTopNumber(9999999);
- }
- return demandPublishMapper.updateByPrimaryKeySelective(d);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<DemandPublishBo> listPublish(String name, String publishPlatform, Integer publishClient,
- String publishPage, Integer ifTop, Integer pageNo, Integer pageSize,String employerName) {
- Map<String, Object> params=new HashMap<String, Object>();
- if (null!=name) {
- params.put("name", name);
- }
- if (null!=publishPlatform) {
- params.put("publishPlatform", publishPlatform);
- }
- if (null!=publishClient) {
- params.put("publishClient", publishClient);
- }
- if (null!=publishPage) {
- params.put("publishPage", publishPage);
- }
- if (null!=ifTop) {
- params.put("ifTop", ifTop);
- }
- if (null!=employerName) {
- params.put("employerName", employerName);
- }
- Pagination<DemandPublishBo> p=(Pagination<DemandPublishBo>) findPage("findDemandPublishByPage", "findDemandPublishCount",
- params,pageNo, pageSize);
- List<DemandPublishBo> dp=(List<DemandPublishBo>) p.getList();
- List <PublishPageBo> pp=DemandPublishPageService.getBranchInformation();
- for (DemandPublishBo d : dp) {
- for (PublishPageBo b : pp) {
- if (d.getPublishPage().equals(b.getId())) {
- d.setPublishPageName(b.getName());
- }
-
- }
- }
- return p;
- }
-
- }
|