Commit c8225e8d by 阳浪

投稿发布

parent 0a4a8fab
......@@ -30,6 +30,8 @@ public interface InformationService extends IService<Information> {
Long insertInformation(Information information);
Long insertInformation(Information information,Long id);
/**
* 资讯发布(批量)
*/
......
......@@ -1075,7 +1075,14 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
@Override
public Long insertInformation(Information information) {
Long id = idGenerator.generate();
return insertInformation(information,null);
}
@Override
public Long insertInformation(Information information,Long id) {
if(id==null){
id = idGenerator.generate();
}
information.setId(id);
information.setIsTop(0L);
// 判断时间
......@@ -1167,8 +1174,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
Information selectById = null;
for (Long id : ids) {
selectById = this.selectById(id);
selectById.setState(1);
list.add(selectById);
if(selectById!=null) {
selectById.setState(1);
list.add(selectById);
}
}
if (list.size() > 0) {
this.updateBatchById(list);
......
......@@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.cache.RedisCache;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.site.application.constant.SiteConstant;
import com.yizhi.site.application.domain.DataClassification;
import com.yizhi.site.application.domain.Information;
import com.yizhi.site.application.domain.ProtalPlate;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.mapper.*;
......@@ -51,6 +53,9 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi
private ProtalPlateService protalPlateService;
@Autowired
private InformationService informationService;
@Autowired
private InformationClassifyMapper informationClassifyMapper;
@Autowired
private RedisTemplate redisTemplate;
......@@ -150,12 +155,21 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi
@Override
public boolean releases(ParamVO vo) {
List<Long> ids = vo.getIds();
RequestContext res = ContextHolder.get();
Long siteId = res.getSiteId();
List<Publication> list = new ArrayList<Publication>();
Publication selectById = null;
for (Long id : ids) {
selectById = this.selectById(id);
selectById.setState(SiteConstant.FOUR);
selectById.setReleaseTime(new Date());
list.add(selectById);
Information informationViewVO = informationService.getInformation(id,siteId);
if(informationViewVO==null||informationViewVO.getId()==null) {
Information information = new Information();
BeanUtils.copyProperties(selectById, information);
informationService.insertInformation(information, id);
}
}
if (list.size() > 0) {
this.updateBatchById(list);
......@@ -184,6 +198,7 @@ public class PublicationServiceImpl extends ServiceImpl<PublicationMapper, Publi
}
if (list.size() > 0) {
this.updateBatchById(list);
informationService.unreleases(vo);
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment