Browse Source

banner bug修改

dev
gupeng 6 years ago
parent
commit
b543b692fa
  1. 21
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/BannerDTO.java
  2. 19
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/BannerEntity.java
  3. 41
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/BannerServiceImpl.java

21
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/BannerDTO.java

@ -19,6 +19,7 @@ package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
@ -129,4 +130,24 @@ public class BannerDTO implements Serializable {
*/
private String newsId;
/**
* 父所有部门
*/
private String parentDeptIds;
/**
* 父所有部门名称
*/
private String parentDeptNames;
/**
* 所有部门
*/
private List<String> allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
}

19
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/BannerEntity.java

@ -98,4 +98,23 @@ public class BannerEntity extends BaseEpdcEntity {
*/
private String newsId;
/**
* 父所有部门
*/
private String parentDeptIds;
/**
* 父所有部门名称
*/
private String parentDeptNames;
/**
* 所有部门
*/
private String allDeptIds;
/**
* 所有部门名称
*/
private String allDeptNames;
}

41
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/BannerServiceImpl.java

@ -32,6 +32,7 @@ import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.BannerDao;
import com.elink.esua.epdc.dto.BannerDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcBannerListFromDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcBannerListResultDTO;
import com.elink.esua.epdc.entity.BannerEntity;
@ -44,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -107,29 +109,34 @@ public class BannerServiceImpl extends BaseServiceImpl<BannerDao, BannerEntity>
if (StringUtils.isBlank(dto.getId())) {
entity.setState(YesOrNoEnum.NO.value());
}
// 通知所属部门id
Long noticeDeptId = entity.getStreetId();
// 能接收通知的所有网格的ID
List<Long> noticeGridList = Lists.newArrayList();
if (null != entity.getCommunityId()) {
noticeDeptId = entity.getCommunityId();
List<String> allDeptIds = dto.getAllDeptIds();
// bnner所属部门id
Long bnnerDeptId = 0L;
if(allDeptIds != null && allDeptIds.size() != 0){
// 塞入全部部门ids,names
bnnerDeptId = Long.valueOf(allDeptIds.get(allDeptIds.size() - 1));
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(bnnerDeptId));
if (!parentResult.success() || parentResult.getData() == null) {
throw new RenException("获取部门信息失败");
}else {
ParentAndAllDeptDTO deptDTO = parentResult.getData();
entity.setAllDeptIds(deptDTO.getAllDeptIds());
entity.setAllDeptNames(deptDTO.getAllDeptNames());
entity.setParentDeptIds(deptDTO.getParentDeptIds());
entity.setParentDeptNames(deptDTO.getParentDeptNames());
}
if (null != entity.getGridId()) {
noticeDeptId = entity.getGridId();
noticeGridList.add(noticeDeptId);
}else {
throw new RenException("所属部门不能为空");
}
if (!user.getDeptIdList().contains(noticeDeptId)) {
if (!user.getDeptIdList().contains(bnnerDeptId)) {
throw new RenException("您没有操作此部门的数据权限");
}
if (CollUtil.isEmpty(noticeGridList)) {
Result<List<Long>> adminResult = adminFeignClient.listGridIdByDeptPid(noticeDeptId);
List<Long> bannerGridList = new ArrayList<>();
Result<List<Long>> adminResult = adminFeignClient.listGridIdByDeptPid(bnnerDeptId);
if (!adminResult.success() || CollUtil.isEmpty(adminResult.getData())) {
throw new RenException("获取部门信息失败");
}
noticeGridList = adminResult.getData();
}
bannerGridList = adminResult.getData();
boolean isSave = true;
if (StringUtils.isNotBlank(dto.getId())) {
@ -143,7 +150,7 @@ public class BannerServiceImpl extends BaseServiceImpl<BannerDao, BannerEntity>
bannerDepartmentService.deleteByBannerId(entity.getId());
}
this.bannerDepartmentService.save(entity.getId(), noticeGridList);
this.bannerDepartmentService.save(entity.getId(), bannerGridList);
}
@Override

Loading…
Cancel
Save