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