Commit 4201b6ce by rongkailun

【新增】政策法规新增修改删除审核

parent 48484d07
...@@ -5,25 +5,20 @@ import java.util.Map; ...@@ -5,25 +5,20 @@ import java.util.Map;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.PolicyEntity; import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.service.PolicyService; import io.office.modules.manage.service.PolicyService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
/** /**
* ${comments} * 政策法规
* *
* @author chenshun * @author rkl
* @email sunlightcs@gmail.com * @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54 * @date 2021-11-04 22:13:54
*/ */
...@@ -93,9 +88,27 @@ public class PolicyController extends AbstractController { ...@@ -93,9 +88,27 @@ public class PolicyController extends AbstractController {
@RequestMapping("/delete") @RequestMapping("/delete")
// @RequiresPermissions("generator:policy:delete") // @RequiresPermissions("generator:policy:delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody Integer[] ids){
policyService.removeByIds(Arrays.asList(ids)); try {
R r = this.policyService.deletePolicy(ids, getUser());
return R.ok(); return r;
} catch (Exception e) {
log.error("delete error:", e);
return R.error(e.getMessage());
}
}
/**
* 审核
*/
@PostMapping("/verifyPolicy")
// @RequiresPermissions("manage:news:verify")
public R verify(@RequestBody PolicyEntity policyEntity) {
try {
R r = this.policyService.verifyTopic(policyEntity,getUser());
return r;
} catch (Exception e) {
log.error("verifyPolicy error:", e);
return R.error(e.getMessage());
}
} }
} }
...@@ -89,11 +89,11 @@ public class PolicyEntity implements Serializable { ...@@ -89,11 +89,11 @@ public class PolicyEntity implements Serializable {
/** /**
* $column.comments * $column.comments
*/ */
private Date publicdate; private String publicdate;
/** /**
* $column.comments * $column.comments
*/ */
private Date startdate; private String startdate;
/** /**
* $column.comments * $column.comments
*/ */
......
...@@ -22,5 +22,9 @@ public interface PolicyService extends IService<PolicyEntity> { ...@@ -22,5 +22,9 @@ public interface PolicyService extends IService<PolicyEntity> {
R inserPolicy(PolicyEntity policy, SysUserEntity user); R inserPolicy(PolicyEntity policy, SysUserEntity user);
R updatePolicy(PolicyEntity policy, SysUserEntity user); R updatePolicy(PolicyEntity policy, SysUserEntity user);
R deletePolicy(Integer[] ids, SysUserEntity user);
R verifyTopic(PolicyEntity policyEntity, SysUserEntity user);
} }
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import io.office.common.utils.DateUtils;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.common.utils.R; import io.office.common.utils.R;
...@@ -34,8 +35,8 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl ...@@ -34,8 +35,8 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
public R inserPolicy(PolicyEntity policy, SysUserEntity user) { public R inserPolicy(PolicyEntity policy, SysUserEntity user) {
policy.setEditor(user.getUsername()); policy.setEditor(user.getUsername());
policy.setLasteditor(user.getUsername()); policy.setLasteditor(user.getUsername());
policy.setStartdate(new Date()); policy.setReleasedate(new Date());
policy.setPublicdate(new Date()); policy.setUpdatedate(new Date());
//二级栏目不为空时 classid取值二级栏目id值 //二级栏目不为空时 classid取值二级栏目id值
int insert = baseMapper.insert(policy); int insert = baseMapper.insert(policy);
if (insert>0){ if (insert>0){
...@@ -54,6 +55,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl ...@@ -54,6 +55,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
newsEntityQueryWrapper.eq("id",policy.getId()); newsEntityQueryWrapper.eq("id",policy.getId());
policy.setEditor(user.getUsername()); policy.setEditor(user.getUsername());
policy.setLasteditor(user.getUsername()); policy.setLasteditor(user.getUsername());
policy.setUpdatedate(new Date());
int update = baseMapper.update(policy, newsEntityQueryWrapper); int update = baseMapper.update(policy, newsEntityQueryWrapper);
if (update>0){ if (update>0){
return R.ok("修改成功!"); return R.ok("修改成功!");
...@@ -62,4 +64,30 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl ...@@ -62,4 +64,30 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
} }
} }
@Override
public R deletePolicy(Integer[] ids, SysUserEntity user) {
PolicyEntity policyEntity = new PolicyEntity();
policyEntity.setLevels(0);
policyEntity.setLasteditor(user.getUsername());
policyEntity.setUpdatedate(new Date());
QueryWrapper<PolicyEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.in("id",ids);
int delete = baseMapper.update(policyEntity, newsEntityQueryWrapper);
if (delete>0){
return R.ok("删除成功!");
}else{
return R.error("删除失败!");
}
}
@Override
public R verifyTopic(PolicyEntity policyEntity, SysUserEntity user) {
policyEntity.setAuditor(user.getUsername());
policyEntity.setLasteditor(user.getUsername());
QueryWrapper<PolicyEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",policyEntity.getId());
baseMapper.update(policyEntity, newsEntityQueryWrapper);
return R.ok("审核成功!");
}
} }
\ 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