|
@@ -14,11 +14,11 @@ import com.ozs.common.constant.Constants;
|
|
import com.ozs.common.constant.ModularConstans;
|
|
import com.ozs.common.constant.ModularConstans;
|
|
import com.ozs.common.core.controller.BaseController;
|
|
import com.ozs.common.core.controller.BaseController;
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
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.core.domain.entity.SysRole;
|
|
import com.ozs.common.core.domain.entity.SysUser;
|
|
import com.ozs.common.core.domain.entity.SysUser;
|
|
|
|
+import com.ozs.common.core.domain.model.LoginUser;
|
|
import com.ozs.common.enums.BusinessType;
|
|
import com.ozs.common.enums.BusinessType;
|
|
-import com.ozs.plan.doman.MonthlyReconciliation;
|
|
|
|
|
|
+import com.ozs.framework.web.service.TokenService;
|
|
import com.ozs.system.service.ISysDeptService;
|
|
import com.ozs.system.service.ISysDeptService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -29,6 +29,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
import javax.validation.constraints.NotEmpty;
|
|
import javax.validation.constraints.NotEmpty;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -44,7 +45,8 @@ public class BaseNoticeController extends BaseController {
|
|
private BaseNoticeService baseNoticeService;
|
|
private BaseNoticeService baseNoticeService;
|
|
@Autowired
|
|
@Autowired
|
|
private BaseNoticeTypeService baseNoticeTypeService;
|
|
private BaseNoticeTypeService baseNoticeTypeService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TokenService tokenService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISysDeptService iSysDeptService;
|
|
private ISysDeptService iSysDeptService;
|
|
|
|
|
|
@@ -53,7 +55,7 @@ public class BaseNoticeController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('base:notice:list')")
|
|
@PreAuthorize("@ss.hasPermi('base:notice:list')")
|
|
@Log(title = ModularConstans.notice, businessType = BusinessType.QUERY)
|
|
@Log(title = ModularConstans.notice, businessType = BusinessType.QUERY)
|
|
public AjaxResult page(@NotEmpty(message = "数据为空")
|
|
public AjaxResult page(@NotEmpty(message = "数据为空")
|
|
- @RequestBody BaseNoticePageReqVo vo) {
|
|
|
|
|
|
+ @RequestBody BaseNoticePageReqVo vo, HttpServletRequest request) {
|
|
LambdaQueryWrapper<BaseNotice> lw = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BaseNotice> lw = new LambdaQueryWrapper<>();
|
|
if (!StringUtils.isBlank(vo.getTitle())) {
|
|
if (!StringUtils.isBlank(vo.getTitle())) {
|
|
lw.like(BaseNotice::getTitle, vo.getTitle());
|
|
lw.like(BaseNotice::getTitle, vo.getTitle());
|
|
@@ -67,6 +69,10 @@ public class BaseNoticeController extends BaseController {
|
|
if (!ObjectUtils.isEmpty(vo.getType())) {
|
|
if (!ObjectUtils.isEmpty(vo.getType())) {
|
|
lw.eq(BaseNotice::getType, vo.getType());
|
|
lw.eq(BaseNotice::getType, vo.getType());
|
|
}
|
|
}
|
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(request);
|
|
|
|
+ if (!loginUser.getUserId().equals(Long.valueOf("1"))) {
|
|
|
|
+ lw.eq(BaseNotice::getDeptId, loginUser.getDeptId());
|
|
|
|
+ }
|
|
lw.orderByDesc(BaseNotice::getReleaseTime);
|
|
lw.orderByDesc(BaseNotice::getReleaseTime);
|
|
IPage<BaseNotice> page = baseNoticeService.page(new Page<>(vo.getPageNum(), vo.getPageSize()), lw);
|
|
IPage<BaseNotice> page = baseNoticeService.page(new Page<>(vo.getPageNum(), vo.getPageSize()), lw);
|
|
IPage<BaseNoticeVo> pagev = new Page<>();
|
|
IPage<BaseNoticeVo> pagev = new Page<>();
|
|
@@ -82,7 +88,7 @@ public class BaseNoticeController extends BaseController {
|
|
BeanUtils.copyProperties(o, baseNoticeVo);
|
|
BeanUtils.copyProperties(o, baseNoticeVo);
|
|
if (ids.contains(o.getType())) {
|
|
if (ids.contains(o.getType())) {
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(o.getType())).collect(Collectors.toList());
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(o.getType())).collect(Collectors.toList());
|
|
- if(!ObjectUtils.isEmpty(collect1)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(collect1)) {
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -90,7 +96,7 @@ public class BaseNoticeController extends BaseController {
|
|
return baseNoticeVo;
|
|
return baseNoticeVo;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
pagev.setRecords(collect);
|
|
pagev.setRecords(collect);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
pagev.setRecords(null);
|
|
pagev.setRecords(null);
|
|
}
|
|
}
|
|
return success(pagev);
|
|
return success(pagev);
|
|
@@ -98,13 +104,12 @@ public class BaseNoticeController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "新增公告信息")
|
|
@ApiOperation(value = "新增公告信息")
|
|
@PostMapping("/insert")
|
|
@PostMapping("/insert")
|
|
@PreAuthorize("@ss.hasPermi('base:notice:add')")
|
|
@PreAuthorize("@ss.hasPermi('base:notice:add')")
|
|
@Log(title = ModularConstans.notice, businessType = BusinessType.INSERT)
|
|
@Log(title = ModularConstans.notice, businessType = BusinessType.INSERT)
|
|
public AjaxResult insert(@NotEmpty(message = "数据为空")
|
|
public AjaxResult insert(@NotEmpty(message = "数据为空")
|
|
- @RequestBody BaseNotice vo) {
|
|
|
|
|
|
+ @RequestBody BaseNotice vo) {
|
|
vo.setCreated(getUserId().toString());
|
|
vo.setCreated(getUserId().toString());
|
|
vo.setCreateTime(new Date());
|
|
vo.setCreateTime(new Date());
|
|
vo.setUpdated(vo.getCreated());
|
|
vo.setUpdated(vo.getCreated());
|
|
@@ -131,11 +136,11 @@ public class BaseNoticeController extends BaseController {
|
|
BaseNotice vo = baseNoticeService.getById(id);
|
|
BaseNotice vo = baseNoticeService.getById(id);
|
|
|
|
|
|
BaseNoticeVo baseNoticeVo = new BaseNoticeVo();
|
|
BaseNoticeVo baseNoticeVo = new BaseNoticeVo();
|
|
- if(!ObjectUtils.isEmpty(vo)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(vo)) {
|
|
BeanUtils.copyProperties(vo, baseNoticeVo);
|
|
BeanUtils.copyProperties(vo, baseNoticeVo);
|
|
List<BaseNoticeType> list = baseNoticeTypeService.list();
|
|
List<BaseNoticeType> list = baseNoticeTypeService.list();
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(vo.getType())).collect(Collectors.toList());
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(vo.getType())).collect(Collectors.toList());
|
|
- if(!ObjectUtils.isEmpty(collect1)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(collect1)) {
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -144,12 +149,11 @@ public class BaseNoticeController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "首页分页查询公告信息")
|
|
@ApiOperation(value = "首页分页查询公告信息")
|
|
@PostMapping("/homePage")
|
|
@PostMapping("/homePage")
|
|
// @Log(title = ModularConstans.notice, businessType = BusinessType.QUERY)
|
|
// @Log(title = ModularConstans.notice, businessType = BusinessType.QUERY)
|
|
public AjaxResult homePage(@NotEmpty(message = "数据为空")
|
|
public AjaxResult homePage(@NotEmpty(message = "数据为空")
|
|
- @RequestBody BaseNoticePageReqVo vo) {
|
|
|
|
|
|
+ @RequestBody BaseNoticePageReqVo vo) {
|
|
vo.setIsAdmin(SysUser.isAdmin(getUserId()));
|
|
vo.setIsAdmin(SysUser.isAdmin(getUserId()));
|
|
vo.setDeptId(getDeptId());
|
|
vo.setDeptId(getDeptId());
|
|
vo.setRoleFlay(false);
|
|
vo.setRoleFlay(false);
|
|
@@ -174,7 +178,7 @@ public class BaseNoticeController extends BaseController {
|
|
BeanUtils.copyProperties(o, baseNoticeVo);
|
|
BeanUtils.copyProperties(o, baseNoticeVo);
|
|
if (ids.contains(o.getType())) {
|
|
if (ids.contains(o.getType())) {
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(o.getType())).collect(Collectors.toList());
|
|
List<BaseNoticeType> collect1 = list.stream().filter(tdto -> tdto.getId().equals(o.getType())).collect(Collectors.toList());
|
|
- if(!ObjectUtils.isEmpty(collect1)){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(collect1)) {
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
baseNoticeVo.setTypeName(collect1.get(0).getName());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -182,7 +186,7 @@ public class BaseNoticeController extends BaseController {
|
|
return baseNoticeVo;
|
|
return baseNoticeVo;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
pagev.setRecords(collect);
|
|
pagev.setRecords(collect);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
pagev.setRecords(null);
|
|
pagev.setRecords(null);
|
|
}
|
|
}
|
|
return success(pagev);
|
|
return success(pagev);
|