征求意见流程-----加按钮判断权限接口

This commit is contained in:
yuezhihang
2021-08-03 13:56:33 +08:00
parent 09e4a5a767
commit 6f654406fd
3 changed files with 49 additions and 30 deletions
@@ -52,6 +52,14 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
return Result.success("200",publicList);
}
@ApiOperation(value = "查询全部意见")
@GetMapping("/checkIsShow")
public ResponseMessage checkIsShow(DetAllStandDto detAllStandDto){
String publicList =sarPublicIdeaAllImpl.checkIsShow(detAllStandDto);
return Result.success("200",publicList);
}
@ApiOperation(value = "增加意见")
@PostMapping("/insetStand")
public ResponseMessage addAllStand(SarPublicIdeaAll sar){
@@ -26,4 +26,5 @@ public interface ISarPublicIdeaAllService extends IService<SarPublicIdeaAll> {
String updateById(SarPublicIdeaAll sarPublicIdeaAll, String autUserid);
String delete(DelStandDto delStandDto);
String del(String id);
String checkIsShow(DetAllStandDto detAllStandDto);
}
@@ -3,10 +3,7 @@ package com.adc.da.slrs.sarStandIdea.service.Impl;
import com.adc.da.slrs.sarLawsDetailedList.Util.BeanConverUtil;
import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaAllDao;
import com.adc.da.slrs.sarStandIdea.entity.DelStandDto;
import com.adc.da.slrs.sarStandIdea.entity.DetAllStandDto;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAllSUD;
import com.adc.da.slrs.sarStandIdea.entity.*;
import com.adc.da.slrs.sarStandIdea.service.ISarPublicIdeaAllService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -25,7 +22,7 @@ import java.util.List;
/**
* <p>
* 服务实现类
* 服务实现类
* </p>
*
* @author super_liu
@@ -38,10 +35,9 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
private SarPublicIdeaAllDao sarPublicIdeaAllDao;
@Override
public IPage<SarPublicIdeaAllSUD> selectAll(DetAllStandDto detAllStandDto){
if (detAllStandDto.getEndTime()!=null){
public IPage<SarPublicIdeaAllSUD> selectAll(DetAllStandDto detAllStandDto) {
if (detAllStandDto.getEndTime() != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date Time = null;
try {
@@ -50,18 +46,18 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
e.printStackTrace();
}
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
wrapper.eq("CID",detAllStandDto.getCid());
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(),detAllStandDto.getSize());
wrapper.eq("CID", detAllStandDto.getCid());
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(), detAllStandDto.getSize());
IPage<SarPublicIdeaAll> userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages());
List<SarPublicIdeaAll> list= userIPage.getRecords();
System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数" + userIPage.getPages());
List<SarPublicIdeaAll> list = userIPage.getRecords();
List<SarPublicIdeaAllSUD> list1 = new ArrayList<>();
list1 = BeanConverUtil.converList(list, SarPublicIdeaAllSUD.class);
for (SarPublicIdeaAllSUD sud:list1){
if (Time.compareTo(new Date())>=0)sud.setIdeaKey(0);
else {sud.setIdeaKey(1);}
}
// for (SarPublicIdeaAllSUD sud:list1){
// if (Time.compareTo(new Date())>=0)sud.setIdeaKey(0);
// else {sud.setIdeaKey(1);}
// }
IPage<SarPublicIdeaAllSUD> userIPage1 = new Page<>();
userIPage1.setPages(userIPage.getPages());
userIPage1.setSize(userIPage.getSize());
@@ -69,19 +65,19 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
userIPage1.setCurrent(userIPage.getCurrent());
userIPage1.setRecords(list1);
return userIPage1;
}else {
} else {
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
wrapper.eq("CID",detAllStandDto.getCid());
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(),detAllStandDto.getSize());
wrapper.eq("CID", detAllStandDto.getCid());
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(), detAllStandDto.getSize());
IPage<SarPublicIdeaAll> userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages());
List<SarPublicIdeaAll> list= userIPage.getRecords();
System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数" + userIPage.getPages());
List<SarPublicIdeaAll> list = userIPage.getRecords();
List<SarPublicIdeaAllSUD> list1 = new ArrayList<>();
list1 = BeanConverUtil.converList(list, SarPublicIdeaAllSUD.class);
for (SarPublicIdeaAllSUD sud:list1){
sud.setIdeaKey(0);
}
// for (SarPublicIdeaAllSUD sud:list1){
// sud.setIdeaKey(0);
// }
IPage<SarPublicIdeaAllSUD> userIPage1 = new Page<>();
userIPage1.setPages(userIPage.getPages());
userIPage1.setSize(userIPage.getSize());
@@ -90,9 +86,23 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
userIPage1.setRecords(list1);
return userIPage1;
}
}
@Override
public String checkIsShow(DetAllStandDto detAllStandDto) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date Time = null;
try {
Time = sdf.parse(detAllStandDto.getEndTime());
} catch (ParseException e) {
e.printStackTrace();
}
if (Time.compareTo(new Date()) >= 0) return "0";
else {
return "1";
}
}
@Override
@@ -105,10 +115,10 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
@Override
public String updateById(SarPublicIdeaAll sar, String autUserid) {
if(sar.getUserId().equals(autUserid)){
if (sar.getUserId().equals(autUserid)) {
sarPublicIdeaAllDao.updateById(sar);
return "修改成功";
}else {
} else {
return "修改失败";
}
@@ -116,9 +126,9 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
@Override
public String delete(DelStandDto delStandDto) {
if (delStandDto.getUserId().equals(delStandDto.getAutUserId())){
if (delStandDto.getUserId().equals(delStandDto.getAutUserId())) {
return del(delStandDto.getId());
}else {
} else {
return "删除失败,不能删除别人的意见";
}