Commit 2acffa17 by 翁国栋

华颐————

管理员删除传阅附件
parent 766c3941
...@@ -7,6 +7,7 @@ import java.util.Timer; ...@@ -7,6 +7,7 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import cn.timer.api.bean.qyxx.*; import cn.timer.api.bean.qyxx.*;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.dto.qyxx.CmsContentReadDto; import cn.timer.api.dto.qyxx.CmsContentReadDto;
import cn.timer.api.utils.redis.RedisUtil; import cn.timer.api.utils.redis.RedisUtil;
import com.github.yulichang.query.MPJQueryWrapper; import com.github.yulichang.query.MPJQueryWrapper;
...@@ -54,7 +55,7 @@ import javax.annotation.Resource; ...@@ -54,7 +55,7 @@ import javax.annotation.Resource;
@RestController @RestController
@Api(tags = "5.0企业讯息") @Api(tags = "5.0企业讯息")
@Transactional @Transactional
@RequestMapping(value = "/qyxx", produces = { "application/json" }) @RequestMapping(value = "/qyxx", produces = {"application/json"})
@Slf4j @Slf4j
public class CmsController { public class CmsController {
...@@ -100,8 +101,8 @@ public class CmsController { ...@@ -100,8 +101,8 @@ public class CmsController {
.leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id"); .leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id");
queryWrapper.eq("t.releasestate", 0) queryWrapper.eq("t.releasestate", 0)
.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1) .and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1)
.or(true,q -> q.eq("t.open_status", 0).eq("ccr.user_id",userBean.getEmpNum())) .or(true, q -> q.eq("t.open_status", 0).eq("ccr.user_id", userBean.getEmpNum()))
.or(true,q -> q.eq("t.open_status", 0).eq("t.userid",userBean.getEmpNum()))) .or(true, q -> q.eq("t.open_status", 0).eq("t.userid", userBean.getEmpNum())))
.eq("t.organization_id", orgCode) .eq("t.organization_id", orgCode)
.groupBy("t.id") .groupBy("t.id")
.orderByDesc("t.releasetime").last("limit 6"); .orderByDesc("t.releasetime").last("limit 6");
...@@ -144,7 +145,6 @@ public class CmsController { ...@@ -144,7 +145,6 @@ public class CmsController {
/** /**
* 分类内容获取 * 分类内容获取
*
*/ */
@GetMapping(value = "/getType") @GetMapping(value = "/getType")
@ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明")
...@@ -163,8 +163,8 @@ public class CmsController { ...@@ -163,8 +163,8 @@ public class CmsController {
.leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id"); .leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id");
queryWrapper.eq("t.releasestate", 0) queryWrapper.eq("t.releasestate", 0)
.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1) .and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1)
.or(true,q -> q.eq("t.open_status", 0).eq("ccr.user_id",userBean.getEmpNum())) .or(true, q -> q.eq("t.open_status", 0).eq("ccr.user_id", userBean.getEmpNum()))
.or(true,q -> q.eq("t.open_status", 0).eq("t.userid",userBean.getEmpNum()))) .or(true, q -> q.eq("t.open_status", 0).eq("t.userid", userBean.getEmpNum())))
.eq("t.organization_id", userBean.getOrgCode()).eq("t.modularid", id) .eq("t.organization_id", userBean.getOrgCode()).eq("t.modularid", id)
.groupBy("t.id") .groupBy("t.id")
.orderByDesc("t.releasetime") .orderByDesc("t.releasetime")
...@@ -177,7 +177,6 @@ public class CmsController { ...@@ -177,7 +177,6 @@ public class CmsController {
/** /**
* 获取分类 * 获取分类
*
*/ */
@GetMapping(value = "/xxfl") @GetMapping(value = "/xxfl")
@ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明")
...@@ -207,7 +206,7 @@ public class CmsController { ...@@ -207,7 +206,7 @@ public class CmsController {
// qynr.setXxbh("XX" + i++); // qynr.setXxbh("XX" + i++);
Boolean a = qynr.getId() == null; Boolean a = qynr.getId() == null;
if(a){ if (a) {
qynr.setUserid(empNum); qynr.setUserid(empNum);
} }
if (a && qynr.getPublisher() == null) if (a && qynr.getPublisher() == null)
...@@ -228,16 +227,16 @@ public class CmsController { ...@@ -228,16 +227,16 @@ public class CmsController {
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum)).getName()); .eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum)).getName());
qynr.setReleasetype(fbfs); qynr.setReleasetype(fbfs);
qynr.setStatus(0); qynr.setStatus(0);
if(fbfs != null && fbfs == 4){ if (fbfs != null && fbfs == 4) {
qynr.setReleasestate(0); qynr.setReleasestate(0);
qynr.setStatus(1); qynr.setStatus(1);
qynr.setReleasetime(now.toString()); qynr.setReleasetime(now.toString());
} }
qynr.insertOrUpdate(); qynr.insertOrUpdate();
// 新增 文件传阅 人员数据 // 新增 文件传阅 人员数据
if(a){ if (a) {
if(!CollectionUtils.isEmpty(cmsContentDto.getCmsContentReads())){ if (!CollectionUtils.isEmpty(cmsContentDto.getCmsContentReads())) {
for (CmsContentRead entity :cmsContentDto.getCmsContentReads() ) { for (CmsContentRead entity : cmsContentDto.getCmsContentReads()) {
entity.setCmsContentId(qynr.getId()); entity.setCmsContentId(qynr.getId());
entity.setOrgCode(orgCode); entity.setOrgCode(orgCode);
entity.setReadStatus(0); entity.setReadStatus(0);
...@@ -247,8 +246,8 @@ public class CmsController { ...@@ -247,8 +246,8 @@ public class CmsController {
} }
} }
if (a){ if (a) {
String msg = fbfs==4?"提交成功":"提交成功、等待管理员审核"; String msg = fbfs == 4 ? "提交成功" : "提交成功、等待管理员审核";
return ResultUtil.data(qynr, msg); return ResultUtil.data(qynr, msg);
} else { } else {
return ResultUtil.data(qynr, "修改成功"); return ResultUtil.data(qynr, "修改成功");
...@@ -350,7 +349,7 @@ public class CmsController { ...@@ -350,7 +349,7 @@ public class CmsController {
MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>(); MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>();
queryWrapper.selectAll(CmsContent.class) queryWrapper.selectAll(CmsContent.class)
.leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id"); .leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id");
queryWrapper.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1).or(true,sq -> sq.eq("t.open_status", 0).eq("ccr.user_id",userBean.getEmpNum()))); queryWrapper.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1).or(true, sq -> sq.eq("t.open_status", 0).eq("ccr.user_id", userBean.getEmpNum())));
queryWrapper.eq("t.organization_id", userBean.getOrgCode()).eq("t.status", 1).eq("t.releasestate", 0) queryWrapper.eq("t.organization_id", userBean.getOrgCode()).eq("t.status", 1).eq("t.releasestate", 0)
.eq(t != null && t > -1, "t.modularid", t).eq(r != null && r > -1, "t.releasestate", r) .eq(t != null && t > -1, "t.modularid", t).eq(r != null && r > -1, "t.releasestate", r)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "t.releasetime", .between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "t.releasetime",
...@@ -418,7 +417,7 @@ public class CmsController { ...@@ -418,7 +417,7 @@ public class CmsController {
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime", .between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00",
!StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00") !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(wq -> wq.eq("publisher", userBean.getEmpNum()).or().eq("author", userBean.getUserInfo().getName()).or().inSql("id","select cms_content_id from cms_content_read where user_id ="+userBean.getEmpNum())) .and(wq -> wq.eq("publisher", userBean.getEmpNum()).or().eq("author", userBean.getUserInfo().getName()).or().inSql("id", "select cms_content_id from cms_content_read where user_id =" + userBean.getEmpNum()))
.orderByDesc("addeddate"); .orderByDesc("addeddate");
IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper); IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
...@@ -470,7 +469,7 @@ public class CmsController { ...@@ -470,7 +469,7 @@ public class CmsController {
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode()) queryWrapper.eq("organization_id", userBean.getOrgCode())
.select("id", "publisher_name", "auditopinion", "modularid", "status", "title", "releasetime", .select("id", "publisher_name", "auditopinion", "modularid", "status", "title", "releasetime",
"addeddate", "author", "summary", "releasetype", "fmtpath","filepath","open_status") "addeddate", "author", "summary", "releasetype", "fmtpath", "filepath", "open_status")
.ne("status", 1).eq(t != null && t > -1, "modularid", t) .ne("status", 1).eq(t != null && t > -1, "modularid", t)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime", .between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00",
...@@ -650,6 +649,7 @@ public class CmsController { ...@@ -650,6 +649,7 @@ public class CmsController {
/** /**
* 查询传阅列表 * 查询传阅列表
*
* @return * @return
*/ */
@PostMapping(value = "/getCmsContentReads") @PostMapping(value = "/getCmsContentReads")
...@@ -675,17 +675,17 @@ public class CmsController { ...@@ -675,17 +675,17 @@ public class CmsController {
.selectOne(new QueryWrapper<CmsContentRead>().lambda() .selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getUserId, userBean.getEmpNum()) .eq(CmsContentRead::getUserId, userBean.getEmpNum())
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode()) .eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
.eq(CmsContentRead::getCmsContentId,id)); .eq(CmsContentRead::getCmsContentId, id));
if(cmsContentRead == null){ if (cmsContentRead == null) {
cmsContentRead = new CmsContentRead(); cmsContentRead = new CmsContentRead();
cmsContentRead.setUserId(userBean.getEmpNum()); cmsContentRead.setUserId(userBean.getEmpNum());
cmsContentRead.setUserName(userBean.getUserInfo().getName()); cmsContentRead.setUserName(userBean.getUserInfo().getName());
cmsContentRead.setOrgCode(userBean.getOrgCode()); cmsContentRead.setOrgCode(userBean.getOrgCode());
cmsContentRead.setCmsContentId(id); cmsContentRead.setCmsContentId(id);
}else { } else {
//已阅 直接返回 //已阅 直接返回
if(cmsContentRead.getReadStatus() == 1){ if (cmsContentRead.getReadStatus() == 1) {
return ResultUtil.data(1); return ResultUtil.data(1);
} }
} }
...@@ -694,7 +694,7 @@ public class CmsController { ...@@ -694,7 +694,7 @@ public class CmsController {
cmsContentRead.setReadStatus(1); cmsContentRead.setReadStatus(1);
cmsContentRead.setReviewTime(new Date()); cmsContentRead.setReviewTime(new Date());
cmsContentRead.insertOrUpdate(); cmsContentRead.insertOrUpdate();
}catch (Exception e){ } catch (Exception e) {
log.error("=============已阅操作失败, " + e); log.error("=============已阅操作失败, " + e);
return ResultUtil.error(e); return ResultUtil.error(e);
} }
...@@ -703,6 +703,7 @@ public class CmsController { ...@@ -703,6 +703,7 @@ public class CmsController {
/** /**
* 根据讯息id查传阅列表 * 根据讯息id查传阅列表
*
* @return * @return
*/ */
@PostMapping(value = "/comment") @PostMapping(value = "/comment")
...@@ -713,54 +714,75 @@ public class CmsController { ...@@ -713,54 +714,75 @@ public class CmsController {
.selectOne(new QueryWrapper<CmsContentRead>().lambda() .selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getUserId, userBean.getEmpNum()) .eq(CmsContentRead::getUserId, userBean.getEmpNum())
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode()) .eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
.eq(CmsContentRead::getCmsContentId,cmsContentReadDto.getCmsContentId())); .eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()));
try { try {
cmsContentRead.setReviewContent(cmsContentReadDto.getReviewContent()); cmsContentRead.setReviewContent(cmsContentReadDto.getReviewContent());
cmsContentRead.insertOrUpdate(); cmsContentRead.insertOrUpdate();
}catch (Exception e){ } catch (Exception e) {
log.error("=============评论失败, " + e); log.error("=============评论失败, " + e);
return ResultUtil.error(e); return ResultUtil.error(e);
} }
return ResultUtil.success(); return ResultUtil.success();
} }
/** /**
* 根据讯息id查传阅增加文件 * 根据讯息id查传阅增加文件
*
* @return * @return
*/ */
@PostMapping(value = "/cmsAddFile") @PostMapping(value = "/cmsAddFile")
@ApiOperation(value = "文件传阅增加文件", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "文件传阅增加文件", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> cmsAddFile(@CurrentUser UserBean userBean, @RequestBody JSONObject request) { public Result<Object> cmsAddFile(@CurrentUser UserBean userBean, @RequestBody JSONObject request) {
String cmsContentId=request.getString("cmsContentId"); String cmsContentId = request.getString("cmsContentId");
//用户id查询传阅消息 //用户id查询传阅消息
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", cmsContentId); queryWrapper.eq("id", cmsContentId);
CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper); CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper);
JSONArray addjsonArray=JSONArray.fromObject(request.getString("filepathcms")); JSONArray addjsonArray = JSONArray.fromObject(request.getString("filepathcms"));
JSONArray resjsonArray=JSONArray.fromObject(cmsContent.getFilepath()); JSONArray resjsonArray = JSONArray.fromObject(cmsContent.getFilepath());
resjsonArray.addAll(addjsonArray); resjsonArray.addAll(addjsonArray);
cmsContent.setFilepath(resjsonArray.toString()); cmsContent.setFilepath(resjsonArray.toString());
cmsContentMapper.updateById(cmsContent); cmsContentMapper.updateById(cmsContent);
return ResultUtil.data(resjsonArray.toString()); return ResultUtil.data(resjsonArray.toString());
} }
/** /**
* 添加传阅人员 * 添加传阅人员
*
* @return * @return
*/ */
@PostMapping(value = "/addReadPersonnel") @PostMapping(value = "/addReadPersonnel")
@ApiOperation(value = "添加传阅人员", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "添加传阅人员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> addReadPersonnel(@CurrentUser UserBean userBean, @RequestBody List<CmsContentRead> cmsContentReads) { public Result<Object> addReadPersonnel(@CurrentUser UserBean userBean, @RequestBody List<CmsContentRead> cmsContentReads) {
for (CmsContentRead ccr:cmsContentReads for (CmsContentRead ccr : cmsContentReads
) { ) {
ccr.insert(); ccr.insert();
} }
return ResultUtil.success(); return ResultUtil.success();
} }
@PostMapping(value = "/getUnreadCmsList") @PostMapping(value = "/getUnreadCmsList")
@ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> shxxquery(@CurrentUser UserBean userBean) { public Result<Object> shxxquery(@CurrentUser UserBean userBean) {
return ResultUtil.data(cmsIsReadMapper.getUnreadList(userBean.getEmpNum())); return ResultUtil.data(cmsIsReadMapper.getUnreadList(userBean.getEmpNum()));
} }
@PostMapping(value = "/adminDeleteFile")
@ApiOperation(value = "管理员删除附件", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> adminDeleteFile(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent.getUserType() == 2) {
return ResultUtil.error("当前用户没有权限操作");
}
CmsContent cmsContent = CmsContent.builder().id(cmsContentReadDto.getId()).build().selectById();
JSONArray resjsonArray = JSONArray.fromObject(cmsContent.getFilepath());
/*不转为int会默认使用remove(object)*/
resjsonArray.remove((int)cmsContentReadDto.getFileIndex());
cmsContent.setFilepath(resjsonArray.toString());
cmsContent.updateById();
return ResultUtil.success("删除附件成功");
}
} }
...@@ -4,6 +4,7 @@ import cn.timer.api.utils.Page; ...@@ -4,6 +4,7 @@ import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -53,4 +54,7 @@ public class CmsContentReadDto extends Page implements Serializable { ...@@ -53,4 +54,7 @@ public class CmsContentReadDto extends Page implements Serializable {
@ApiModelProperty(value = "更新时间", example = "") @ApiModelProperty(value = "更新时间", example = "")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "附件索引", example = "")
private Integer fileIndex;
} }
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