|
@@ -3,12 +3,16 @@ package com.sooka.jnb.information.service.impl;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+import com.github.pagehelper.Page;
|
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.sooka.jnb.highServer.domain.JnbHighServerImg;
|
|
import com.sooka.jnb.highServer.domain.JnbHighServerImg;
|
|
import com.sooka.jnb.highServer.mapper.JnbHighServerImgMapper;
|
|
import com.sooka.jnb.highServer.mapper.JnbHighServerImgMapper;
|
|
import com.sooka.jnb.information.domain.Information;
|
|
import com.sooka.jnb.information.domain.Information;
|
|
|
|
+import com.sooka.jnb.information.domain.InformationUni;
|
|
import com.sooka.jnb.information.mapper.InformationMapper;
|
|
import com.sooka.jnb.information.mapper.InformationMapper;
|
|
import com.sooka.jnb.information.service.InformationService;
|
|
import com.sooka.jnb.information.service.InformationService;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -38,7 +42,15 @@ public class InformationServiceImpl implements InformationService
|
|
information.setImgUrlList(jnbHighServerImgMapper.selectAll(id,information.getType()));
|
|
information.setImgUrlList(jnbHighServerImgMapper.selectAll(id,information.getType()));
|
|
return information;
|
|
return information;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Information selectInformationByIdgetInfoUniApp(Long id,Integer type)
|
|
|
|
+ {
|
|
|
|
+ Information information = informationMapper.selectInformationById(id,type);
|
|
|
|
+ information.setUrls(jnbHighServerImgMapper.selectAllList(id,information.getType()));
|
|
|
|
+ informationMapper.updateInformationWatch(information);
|
|
|
|
+ return information;
|
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<Information> selectInformationList(Information information)
|
|
public List<Information> selectInformationList(Information information)
|
|
@@ -52,9 +64,28 @@ public class InformationServiceImpl implements InformationService
|
|
return informationMapper.selectInformationListWx(information);
|
|
return informationMapper.selectInformationListWx(information);
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
- public List<Information> selectInformationListWxs(Information information)
|
|
|
|
|
|
+ public TableDataInfo selectInformationListWxs(Information information, Integer pageNum, Integer pageSize)
|
|
{
|
|
{
|
|
- return informationMapper.selectInformationListWxs(information);
|
|
|
|
|
|
+// List<Information> result = informationMapper.selectInformationListWxs(information,pageNum, pageSize);
|
|
|
|
+ List<Information> toolForAbsenteeism = informationMapper.selectInformationListWxs(information,pageNum, pageSize);
|
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
|
+ tableDataInfo.setRows(toolForAbsenteeism.stream() .skip((long) (pageNum - 1) * pageSize)
|
|
|
|
+ .limit(pageSize)
|
|
|
|
+ .collect(Collectors.toList()));
|
|
|
|
+ tableDataInfo.setTotal(toolForAbsenteeism.size());
|
|
|
|
+ tableDataInfo.setCode(200);
|
|
|
|
+ tableDataInfo.setMsg("查询成功");
|
|
|
|
+ return tableDataInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int likeById(Information information) {
|
|
|
|
+ return informationMapper.updateInformationLike(information);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int watchById(Information information) {
|
|
|
|
+ return informationMapper.updateInformationWatch(information);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -66,8 +97,8 @@ public class InformationServiceImpl implements InformationService
|
|
entity.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
entity.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
int i = informationMapper.insertInformation(entity);
|
|
int i = informationMapper.insertInformation(entity);
|
|
if (i>0){
|
|
if (i>0){
|
|
- List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
|
|
- if (!ObjectUtils.isEmpty(imgUrlList)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(entity.getImgUrlList())){
|
|
|
|
+ List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
imgUrlList.forEach(a->{
|
|
imgUrlList.forEach(a->{
|
|
JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
@@ -87,13 +118,41 @@ public class InformationServiceImpl implements InformationService
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public int insertInformationServerUni(InformationUni entity)
|
|
|
|
+ {
|
|
|
|
+ entity.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ entity.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
|
+ Information obj = new Information();
|
|
|
|
+ BeanUtils.copyProperties(entity,obj);
|
|
|
|
+ int i = informationMapper.insertInformation(obj);
|
|
|
|
+ if (i>0){
|
|
|
|
+ if (!ObjectUtils.isEmpty(entity.getUrls())){
|
|
|
|
+ List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
|
|
+ entity.getUrls().forEach(a->{
|
|
|
|
+ JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
|
|
+ serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
|
+ serverImg.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ serverImg.setServerId(entity.getId());
|
|
|
|
+ serverImg.setImgUrl(a);
|
|
|
|
+ serverImg.setType(entity.getType());
|
|
|
|
+ imgList.add(serverImg);
|
|
|
|
+ });
|
|
|
|
+ jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public int updateInformation(Information entity)
|
|
public int updateInformation(Information entity)
|
|
{
|
|
{
|
|
entity.setUpdateTime(DateUtils.getNowDate());
|
|
entity.setUpdateTime(DateUtils.getNowDate());
|
|
entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
int i = informationMapper.updateInformation(entity);
|
|
int i = informationMapper.updateInformation(entity);
|
|
- List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
|
|
- if (!ObjectUtils.isEmpty(imgUrlList)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(entity.getImgUrlList())){
|
|
|
|
+ List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId(),entity.getType());
|
|
jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId(),entity.getType());
|
|
imgUrlList.forEach(a->{
|
|
imgUrlList.forEach(a->{
|
|
@@ -110,6 +169,31 @@ public class InformationServiceImpl implements InformationService
|
|
return i;
|
|
return i;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public int updateInformationUni(InformationUni entity)
|
|
|
|
+ {
|
|
|
|
+ entity.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
+ entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
|
+ Information obj = new Information();
|
|
|
|
+ BeanUtils.copyProperties(entity,obj);
|
|
|
|
+ int i = informationMapper.updateInformation(obj);
|
|
|
|
+ if (!ObjectUtils.isEmpty(entity.getUrls())){
|
|
|
|
+ List<JnbHighServerImg> imgList = new ArrayList<>();
|
|
|
|
+ jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId(),entity.getType());
|
|
|
|
+ entity.getUrls().forEach(a->{
|
|
|
|
+ JnbHighServerImg serverImg = new JnbHighServerImg();
|
|
|
|
+ serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
|
|
|
+ serverImg.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ serverImg.setServerId(entity.getId());
|
|
|
|
+ serverImg.setImgUrl(a);
|
|
|
|
+ serverImg.setType(entity.getType());
|
|
|
|
+ imgList.add(serverImg);
|
|
|
|
+ });
|
|
|
|
+ jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
|
|
|
|
+ }
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|