Commit 260a8bd5 by rongkailun

【新增】公告通知修改、删除、审核

parent 49890b63
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.GlossaryEntity;
import io.office.modules.manage.entity.NewsEntity; import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.AnnounceEntity; import io.office.modules.manage.entity.AnnounceEntity;
import io.office.modules.manage.service.AnnounceService; import io.office.modules.manage.service.AnnounceService;
...@@ -30,7 +31,7 @@ import io.office.common.utils.R; ...@@ -30,7 +31,7 @@ import io.office.common.utils.R;
*/ */
@RestController @RestController
@RequestMapping("/announce") @RequestMapping("/announce")
public class AnnounceController { public class AnnounceController extends AbstractController {
@Autowired @Autowired
private AnnounceService announceService; private AnnounceService announceService;
...@@ -70,9 +71,8 @@ public class AnnounceController { ...@@ -70,9 +71,8 @@ public class AnnounceController {
@RequestMapping("/save") @RequestMapping("/save")
// @RequiresPermissions("manage:announce:save") // @RequiresPermissions("manage:announce:save")
public R save(@RequestBody AnnounceEntity announce){ public R save(@RequestBody AnnounceEntity announce){
announceService.save(announce); announceService.insertAnnounce(announce,getUser());
return R.ok("新增成功!");
return R.ok();
} }
/** /**
...@@ -81,9 +81,10 @@ public class AnnounceController { ...@@ -81,9 +81,10 @@ public class AnnounceController {
@RequestMapping("/update") @RequestMapping("/update")
// @RequiresPermissions("manage:announce:update") // @RequiresPermissions("manage:announce:update")
public R update(@RequestBody AnnounceEntity announce){ public R update(@RequestBody AnnounceEntity announce){
announce.setEditor(getUser().getUsername());
announce.setUpdatedate(new Date());
announceService.updateById(announce); announceService.updateById(announce);
return R.ok("修改成功!");
return R.ok();
} }
/** /**
...@@ -91,10 +92,26 @@ public class AnnounceController { ...@@ -91,10 +92,26 @@ public class AnnounceController {
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("manage:announce:delete") // @RequiresPermissions("manage:announce:delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody List<String> ids){
announceService.removeByIds(Arrays.asList(ids)); AnnounceEntity announce = new AnnounceEntity();
announce.setEditor(getUser().getUsername());
announce.setUpdatedate(new Date());
announce.setLevels(0);
QueryWrapper<AnnounceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", ids);
announceService.update(announce, queryWrapper);
return R.ok("删除成功!");
}
return R.ok(); /**
* 审核
*/
@PostMapping("/verify")
// @RequiresPermissions("manage:news:verify")
public R verify(@RequestBody AnnounceEntity announce) {
R r = this.announceService.verify(announce,getUser());
return R.ok("审核成功!");
} }
} }
...@@ -3,8 +3,10 @@ package io.office.modules.manage.service; ...@@ -3,8 +3,10 @@ package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.AnnounceEntity; import io.office.modules.manage.entity.AnnounceEntity;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.Map; import java.util.Map;
...@@ -20,5 +22,9 @@ public interface AnnounceService extends IService<AnnounceEntity> { ...@@ -20,5 +22,9 @@ public interface AnnounceService extends IService<AnnounceEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
Page<AnnounceEntity> selectAnnounceList(NewsParams newsParams, Page page); Page<AnnounceEntity> selectAnnounceList(NewsParams newsParams, Page page);
void insertAnnounce(AnnounceEntity announce, SysUserEntity user);
R verify(AnnounceEntity announce, SysUserEntity user);
} }
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity; import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -42,4 +45,24 @@ public class AnnounceServiceImpl extends ServiceImpl<AnnounceDao, AnnounceEntity ...@@ -42,4 +45,24 @@ public class AnnounceServiceImpl extends ServiceImpl<AnnounceDao, AnnounceEntity
return page; return page;
} }
@Override
public void insertAnnounce(AnnounceEntity announce, SysUserEntity user) {
announce.setReleasedate(new Date());
announce.setUpdatedate(new Date());
announce.setEditor(user.getUsername());
announce.setStatus(0);
this.baseMapper.insert(announce);
}
@Override
public R verify(AnnounceEntity announce, SysUserEntity user) {
announce.setUpdatedate(new Date());
announce.setEditor(user.getUsername());
announce.setAuditor(user.getUsername());
QueryWrapper<AnnounceEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",announce.getId());
announceDao.update(announce, newsEntityQueryWrapper);
return null;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment