|
@@ -10,10 +10,15 @@ import com.ozs.base.service.BaseNoticeTypeService;
|
|
|
import com.ozs.base.vo.BaseNoticePageReqVo;
|
|
|
import com.ozs.base.vo.BaseNoticeVo;
|
|
|
import com.ozs.common.annotation.Log;
|
|
|
+import com.ozs.common.constant.Constants;
|
|
|
import com.ozs.common.constant.ModularConstans;
|
|
|
import com.ozs.common.core.controller.BaseController;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.common.core.domain.entity.SysDept;
|
|
|
+import com.ozs.common.core.domain.entity.SysRole;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
+import com.ozs.plan.doman.MonthlyReconciliation;
|
|
|
+import com.ozs.system.service.ISysDeptService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -39,6 +44,9 @@ public class BaseNoticeController extends BaseController {
|
|
|
@Autowired
|
|
|
private BaseNoticeTypeService baseNoticeTypeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService iSysDeptService;
|
|
|
+
|
|
|
@ApiOperation(value = "分页查询公告信息")
|
|
|
@PostMapping("/page")
|
|
|
@PreAuthorize("@ss.hasPermi('base:notice:list')")
|
|
@@ -130,4 +138,84 @@ public class BaseNoticeController extends BaseController {
|
|
|
return success(baseNoticeVo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页查询公告信息")
|
|
|
+ @PostMapping("/homePage")
|
|
|
+ @Log(title = ModularConstans.notice, businessType = BusinessType.QUERY)
|
|
|
+ public AjaxResult homePage(@NotEmpty(message = "数据为空")
|
|
|
+ @RequestBody BaseNoticePageReqVo vo) {
|
|
|
+ LambdaQueryWrapper<BaseNotice> lw = new LambdaQueryWrapper<>();
|
|
|
+ if(!StringUtils.isBlank(vo.getTitle())){
|
|
|
+ lw.like(BaseNotice::getTitle,vo.getTitle());
|
|
|
+ }
|
|
|
+ if(!ObjectUtils.isEmpty(vo.getStartTime())){
|
|
|
+ lw.ge(BaseNotice::getReleaseTime,vo.getStartTime());
|
|
|
+ }
|
|
|
+ if(!ObjectUtils.isEmpty(vo.getStartTime())){
|
|
|
+ lw.le(BaseNotice::getReleaseTime,vo.getEntTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加数据权限
|
|
|
+ List<String> roleKeys = getLoginUser().getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
+ if (roleKeys.contains(Constants.DEMAND_UNIT)) {
|
|
|
+ // 需求单位
|
|
|
+ /*(purchase_dept_id = 当前用户deptID) */
|
|
|
+ lw.eq(BaseNotice::getDeptId, getDeptId());
|
|
|
+ } else if (roleKeys.contains(Constants.PURCHASING_MANAGEMENT)
|
|
|
+ || roleKeys.contains(Constants.PURCHASE_SERVICES)) {
|
|
|
+ // 采购管理部门 或 采购办
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
+ sysDept.setParentId(getDeptId());
|
|
|
+ sysDept.setStatus("0");
|
|
|
+ List<Long> childDeptIds = iSysDeptService.selectDeptList(sysDept)
|
|
|
+ .stream()
|
|
|
+ .map(SysDept::getDeptId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(ObjectUtils.isEmpty(childDeptIds)){
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(BaseNotice::getIsExcess, 0);
|
|
|
+ wrapper.eq(BaseNotice::getDeptId, getDeptId());
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(BaseNotice::getIsExcess, 0);
|
|
|
+ wrapper.eq(BaseNotice::getDeptId, getDeptId());
|
|
|
+ })
|
|
|
+ .or((wrapper) -> {
|
|
|
+ wrapper.eq(BaseNotice::getIsExcess, 1);
|
|
|
+ wrapper.in(BaseNotice::getDeptId, childDeptIds);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ IPage<BaseNotice> page = baseNoticeService.page(new Page<>(vo.getPageNum(), vo.getPageSize()), lw);
|
|
|
+ IPage<BaseNoticeVo> pagev = new Page<>();
|
|
|
+ pagev.setTotal(page.getTotal());
|
|
|
+ pagev.setCurrent(page.getCurrent());
|
|
|
+ pagev.setPages(page.getPages());
|
|
|
+
|
|
|
+ if(!ObjectUtils.isEmpty(page) && page.getRecords().size()>0){
|
|
|
+ List<BaseNoticeType> list = baseNoticeTypeService.list();
|
|
|
+ List<Long> ids = list.stream().map(BaseNoticeType::getId).collect(Collectors.toList());
|
|
|
+ List<BaseNoticeVo> collect = page.getRecords().stream().map(o -> {
|
|
|
+ BaseNoticeVo baseNoticeVo = new BaseNoticeVo();
|
|
|
+ BeanUtils.copyProperties(o, baseNoticeVo);
|
|
|
+ if (ids.contains(o.getType())) {
|
|
|
+ List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(o.getType())).collect(Collectors.toList());
|
|
|
+ if(!ObjectUtils.isEmpty(collect1)){
|
|
|
+ baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return baseNoticeVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ pagev.setRecords(collect);
|
|
|
+ }else {
|
|
|
+ pagev.setRecords(null);
|
|
|
+ }
|
|
|
+ return success(pagev);
|
|
|
+
|
|
|
+ }
|
|
|
}
|