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,65 +55,65 @@ import javax.annotation.Resource; ...@@ -54,65 +55,65 @@ 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 {
@Autowired @Autowired
private CmsContentMapper cmsContentMapper; private CmsContentMapper cmsContentMapper;
@Autowired @Autowired
private CmsIsReadMapper cmsIsReadMapper; private CmsIsReadMapper cmsIsReadMapper;
// @Autowired // @Autowired
// private CmsAnnouncementMapper cmsAnnouncementMapper; // private CmsAnnouncementMapper cmsAnnouncementMapper;
/** /**
* 查询所有讯息 * 查询所有讯息
*/ */
@GetMapping(value = "/hqqyxx") @GetMapping(value = "/hqqyxx")
@ApiOperation(value = "获取企业讯息", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取企业讯息", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CmsContent>> getQyxx(@CurrentUser UserBean userBean) { public Result<List<CmsContent>> getQyxx(@CurrentUser UserBean userBean) {
if (userBean.getOrgCode() != null) { if (userBean.getOrgCode() != null) {
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", orgCode); queryWrapper.eq("organization_id", orgCode);
List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper); List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper);
return ResultUtil.data(qynr, "查询成功!"); return ResultUtil.data(qynr, "查询成功!");
} }
return ResultUtil.error("请登录!"); return ResultUtil.error("请登录!");
} }
/** /**
* 查询最新讯息,获取标题和发布时间 * 查询最新讯息,获取标题和发布时间
*/ */
@GetMapping(value = "/zxqyxx") @GetMapping(value = "/zxqyxx")
@ApiOperation(value = "获取最新讯息的标题、发布时间", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取最新讯息的标题、发布时间", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CmsContent>> groupbyTime(@CurrentUser UserBean userBean) { public Result<List<CmsContent>> groupbyTime(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>(); MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>();
queryWrapper.select("t.id", "t.title", "t.author", "t.releasetime", "t.fmtpath") queryWrapper.select("t.id", "t.title", "t.author", "t.releasetime", "t.fmtpath")
.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");
List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper); List<CmsContent> qynr = CmsContent.builder().build().selectList(queryWrapper);
return ResultUtil.data(qynr, "查询分类成功!"); return ResultUtil.data(qynr, "查询分类成功!");
} }
/** /**
* 分类,获取标题和发布时间 * 分类,获取标题和发布时间
* *
*/ */
// @GetMapping(value = "/flhqqyxx") // @GetMapping(value = "/flhqqyxx")
// @ApiOperation(value = "获取首页分类讯息标题、发布时间", httpMethod = "GET", notes = "接口发布说明") // @ApiOperation(value = "获取首页分类讯息标题、发布时间", httpMethod = "GET", notes = "接口发布说明")
// public Result<List<List<CmsContent>>> groupbyTpye(@CurrentUser UserBean userBean) { // public Result<List<List<CmsContent>>> groupbyTpye(@CurrentUser UserBean userBean) {
...@@ -142,625 +143,646 @@ public class CmsController { ...@@ -142,625 +143,646 @@ public class CmsController {
// return ResultUtil.data(cmsContentList, "查询成功!"); // return ResultUtil.data(cmsContentList, "查询成功!");
// } // }
/** /**
* 分类内容获取 * 分类内容获取
* */
*/ @GetMapping(value = "/getType")
@GetMapping(value = "/getType") @ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明")
@ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明") public Result<Object> getType(@CurrentUser UserBean userBean) {
public Result<Object> getType(@CurrentUser UserBean userBean) { // 分类模块信息
// 分类模块信息 List<CmsContentModular> list = CmsContentModular.builder().build()
List<CmsContentModular> list = CmsContentModular.builder().build() .selectList(new QueryWrapper<CmsContentModular>().eq("is_open", 0) // 是否开启
.selectList(new QueryWrapper<CmsContentModular>().eq("is_open", 0) // 是否开启
// .eq("organization_id", userBean.getOrgCode()) // .eq("organization_id", userBean.getOrgCode())
); );
List<List<CmsContent>> o = new ArrayList<List<CmsContent>>(); List<List<CmsContent>> o = new ArrayList<List<CmsContent>>();
for (CmsContentModular cmsContentModular : list) { for (CmsContentModular cmsContentModular : list) {
// 分类模块id // 分类模块id
Integer id = cmsContentModular.getId(); Integer id = cmsContentModular.getId();
MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>(); MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>();
queryWrapper.select("t.id", "t.modularid", "t.title", "t.author", "t.releasetime") queryWrapper.select("t.id", "t.modularid", "t.title", "t.author", "t.releasetime")
.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")
.last("limit 5"); .last("limit 5");
List<CmsContent> qynrs = CmsContent.builder().build().selectList(queryWrapper); List<CmsContent> qynrs = CmsContent.builder().build().selectList(queryWrapper);
o.add(qynrs); o.add(qynrs);
} }
return ResultUtil.data(o, "查询成功!"); return ResultUtil.data(o, "查询成功!");
} }
/** /**
* 获取分类 * 获取分类
* */
*/ @GetMapping(value = "/xxfl")
@GetMapping(value = "/xxfl") @ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明")
@ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明") public Result<Object> getxxfl(@CurrentUser UserBean userBean) {
public Result<Object> getxxfl(@CurrentUser UserBean userBean) { return ResultUtil.data(CmsContentModular.builder().build().selectList(new QueryWrapper<CmsContentModular>()
return ResultUtil.data(CmsContentModular.builder().build().selectList(new QueryWrapper<CmsContentModular>()
// .eq("organization_id", userBean.getOrgCode()) // .eq("organization_id", userBean.getOrgCode())
.eq("is_open", 0) .eq("is_open", 0)
.orderByAsc("sort")), "查询分类成功!"); .orderByAsc("sort")), "查询分类成功!");
} }
/** /**
* 新增/修改企业OA讯息 * 新增/修改企业OA讯息
*/ */
@PostMapping(value = "/updateqyxx") @PostMapping(value = "/updateqyxx")
@ApiOperation(value = "添加/修改企业OA讯息", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "添加/修改企业OA讯息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsContent> updateqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContentDto cmsContentDto) { public Result<CmsContent> updateqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContentDto cmsContentDto) {
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum(); Integer empNum = userBean.getEmpNum();
// String str = StringUtils.join(cmsContentDto.getFilepath(), ","); // 数组转字符串(逗号分隔)(推荐) // String str = StringUtils.join(cmsContentDto.getFilepath(), ","); // 数组转字符串(逗号分隔)(推荐)
CmsContent qynr = new CmsContent(); CmsContent qynr = new CmsContent();
BeanUtil.copyProperties(cmsContentDto, qynr); BeanUtil.copyProperties(cmsContentDto, qynr);
// qynr.setFilepath(str); // qynr.setFilepath(str);
// Integer i = 10000; // Integer i = 10000;
// 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)
qynr.setPublisher(empNum); qynr.setPublisher(empNum);
qynr.setOrganizationId(orgCode); qynr.setOrganizationId(orgCode);
Long now = new Date().getTime(); Long now = new Date().getTime();
// 录入时间 // 录入时间
qynr.setAddeddate(now); qynr.setAddeddate(now);
// 发布方式:1,审核通过后立即发布,2定时发布,3手动发布,4立即发布 // 发布方式:1,审核通过后立即发布,2定时发布,3手动发布,4立即发布
Integer fbfs = qynr.getReleasetype(); Integer fbfs = qynr.getReleasetype();
// 定时 // 定时
if (fbfs != null && fbfs == 2) { if (fbfs != null && fbfs == 2) {
qynr.setReleasetime(qynr.getReleasetime()); qynr.setReleasetime(qynr.getReleasetime());
} }
qynr.setPublisherName(YgglMainEmp.builder().build().selectOne(new LambdaQueryWrapper<YgglMainEmp>() qynr.setPublisherName(YgglMainEmp.builder().build().selectOne(new LambdaQueryWrapper<YgglMainEmp>()
.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);
entity.setDeleteFlag(0); entity.setDeleteFlag(0);
entity.insert(); entity.insert();
} }
} }
} }
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, "修改成功");
} }
} }
/** /**
* 删除企业OA讯息 * 删除企业OA讯息
*/ */
@DeleteMapping(value = "/deleteqyxx") @DeleteMapping(value = "/deleteqyxx")
@ApiOperation(value = "删除企业OA讯息", httpMethod = "DELETE", notes = "接口发布说明") @ApiOperation(value = "删除企业OA讯息", httpMethod = "DELETE", notes = "接口发布说明")
public Result<CmsContent> deleteqyxx(@CurrentUser UserBean userBean, @RequestBody List<CmsContent> ids) { public Result<CmsContent> deleteqyxx(@CurrentUser UserBean userBean, @RequestBody List<CmsContent> ids) {
if (ids != null) { if (ids != null) {
cmsContentMapper.deleteBatchIds(ids); cmsContentMapper.deleteBatchIds(ids);
return ResultUtil.success("删除成功"); return ResultUtil.success("删除成功");
} }
return ResultUtil.error("没这个id"); return ResultUtil.error("没这个id");
} }
/** /**
* 审核企业OA讯息 * 审核企业OA讯息
*/ */
@PostMapping(value = "/shqyxx") @PostMapping(value = "/shqyxx")
@ApiOperation(value = "审核企业OA讯息", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "审核企业OA讯息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsContent> shqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContent qynr) { public Result<CmsContent> shqyxx(@CurrentUser UserBean userBean, @RequestBody CmsContent qynr) {
Long now = new Date().getTime(); Long now = new Date().getTime();
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
Integer empNum = userBean.getEmpNum(); Integer empNum = userBean.getEmpNum();
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda() YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum)); .eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum));
if (ygglMainEmp != null) { if (ygglMainEmp != null) {
qynr.setAuditor(ygglMainEmp.getName());// 审核人 qynr.setAuditor(ygglMainEmp.getName());// 审核人
} }
qynr.setAudittime(now.toString());// 审核时间 qynr.setAudittime(now.toString());// 审核时间
qynr.setAuditopinion(qynr.getAuditopinion());// 审核意见 qynr.setAuditopinion(qynr.getAuditopinion());// 审核意见
// 如果通过审核 // 如果通过审核
if (qynr.getStatus() == 1) { if (qynr.getStatus() == 1) {
if (qynr.getReleasetype() != null && qynr.getReleasetype() == 1) { // 发布方式为审核通过立即发布,设置发布时间为now if (qynr.getReleasetype() != null && qynr.getReleasetype() == 1) { // 发布方式为审核通过立即发布,设置发布时间为now
qynr.setReleasetime(now.toString()); qynr.setReleasetime(now.toString());
// 已发布 // 已发布
qynr.setReleasestate(0); qynr.setReleasestate(0);
} else if (qynr.getReleasetype() == 2) { // 定时发布 } else if (qynr.getReleasetype() == 2) { // 定时发布
QueryWrapper<CmsContent> q = new QueryWrapper<CmsContent>(); QueryWrapper<CmsContent> q = new QueryWrapper<CmsContent>();
q.select("id", "releasetime").eq("id", qynr.getId()); q.select("id", "releasetime").eq("id", qynr.getId());
CmsContent c = CmsContent.builder().build().selectOne(q); CmsContent c = CmsContent.builder().build().selectOne(q);
// 发布时间 // 发布时间
Long fbsj = Long.parseLong(c.getReleasetime()); Long fbsj = Long.parseLong(c.getReleasetime());
Date date = DateUtil.date(fbsj); Date date = DateUtil.date(fbsj);
// 设置为定时发布中 // 设置为定时发布中
qynr.setReleasestate(3); qynr.setReleasestate(3);
qynr.updateById(); qynr.updateById();
// 设置开始定时发布 // 设置开始定时发布
Long deley = fbsj - now; Long deley = fbsj - now;
if (deley >= 0) { if (deley >= 0) {
Timer timer = new Timer(); Timer timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
qynr.setReleasestate(0); qynr.setReleasestate(0);
qynr.updateById(); qynr.updateById();
timer.cancel(); timer.cancel();
} }
}, date); }, date);
} else { } else {
qynr.setReleasestate(0); qynr.setReleasestate(0);
} }
} else if (qynr.getReleasetype() == 3) { // 手动发布 } else if (qynr.getReleasetype() == 3) { // 手动发布
// 未发布 // 未发布
qynr.setReleasestate(1); qynr.setReleasestate(1);
} }
} }
qynr.updateById(); qynr.updateById();
return ResultUtil.data(qynr, "审核完成"); return ResultUtil.data(qynr, "审核完成");
} }
/** /**
* 企业OA讯息查询 * 企业OA讯息查询
*/ */
@PostMapping(value = "/qyxxquery") @PostMapping(value = "/qyxxquery")
@ApiOperation(value = "搜索OA讯息记录", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "搜索OA讯息记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> qyxxquery(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) { public Result<Object> qyxxquery(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime(); String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime(); String e = qyxxQueryDto.getEndTime();
Integer t = qyxxQueryDto.getModularid(); Integer t = qyxxQueryDto.getModularid();
Integer r = qyxxQueryDto.getReleasestate(); Integer r = qyxxQueryDto.getReleasestate();
String q = qyxxQueryDto.getQuery(); String q = qyxxQueryDto.getQuery();
Page<CmsContent> page = new Page<CmsContent>( Page<CmsContent> page = new Page<CmsContent>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
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",
!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(!StrUtil.hasBlank(q), wq -> wq.like("t.userid", q).or().like("t.author", q).or().like("title", q)) .and(!StrUtil.hasBlank(q), wq -> wq.like("t.userid", q).or().like("t.author", q).or().like("title", q))
.groupBy("t.id") .groupBy("t.id")
.orderByDesc("t.addeddate"); .orderByDesc("t.addeddate");
IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper); IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
List<CmsContent> cmsContents = cmsContentPage.getRecords(); List<CmsContent> cmsContents = cmsContentPage.getRecords();
cmsContentPage.getCurrent(); cmsContentPage.getCurrent();
cmsContentPage.getPages(); cmsContentPage.getPages();
cmsContentPage.getTotal(); cmsContentPage.getTotal();
cmsContentPage.getSize(); cmsContentPage.getSize();
return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功"); return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功");
} }
/** /**
* 企业OA讯息查询 * 企业OA讯息查询
*/ */
@PostMapping(value = "/oaalllist") @PostMapping(value = "/oaalllist")
@ApiOperation(value = "搜索OA讯息记录", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "搜索OA讯息记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> oaAllList(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) { public Result<Object> oaAllList(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime(); String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime(); String e = qyxxQueryDto.getEndTime();
Integer t = qyxxQueryDto.getModularid(); Integer t = qyxxQueryDto.getModularid();
Integer r = qyxxQueryDto.getReleasestate(); Integer r = qyxxQueryDto.getReleasestate();
String q = qyxxQueryDto.getQuery(); String q = qyxxQueryDto.getQuery();
Page<CmsContent> page = new Page<CmsContent>( Page<CmsContent> page = new Page<CmsContent>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode()) queryWrapper.eq("organization_id", userBean.getOrgCode())
.eq(t != null && t > -1, "modularid", t).eq(r != null && r > -1, "releasestate", r) .eq(t != null && t > -1, "modularid", t).eq(r != null && r > -1, "releasestate", r)
.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(!StrUtil.hasBlank(q), wq -> wq.like("userid", q).or().like("author", q).or().like("title", q)) .and(!StrUtil.hasBlank(q), wq -> wq.like("userid", q).or().like("author", q).or().like("title", q))
.orderByDesc("addeddate"); .orderByDesc("addeddate");
IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper); IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
List<CmsContent> cmsContents = cmsContentPage.getRecords(); List<CmsContent> cmsContents = cmsContentPage.getRecords();
cmsContentPage.getCurrent(); cmsContentPage.getCurrent();
cmsContentPage.getPages(); cmsContentPage.getPages();
cmsContentPage.getTotal(); cmsContentPage.getTotal();
cmsContentPage.getSize(); cmsContentPage.getSize();
return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功"); return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功");
} }
@PostMapping(value = "/oaCirculate") @PostMapping(value = "/oaCirculate")
@ApiOperation(value = "搜索OA文件传阅记录", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "搜索OA文件传阅记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> oaCirculate(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) { public Result<Object> oaCirculate(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime(); String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime(); String e = qyxxQueryDto.getEndTime();
Integer r = qyxxQueryDto.getReleasestate(); Integer r = qyxxQueryDto.getReleasestate();
Page<CmsContent> page = new Page<CmsContent>( Page<CmsContent> page = new Page<CmsContent>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode()) queryWrapper.eq("organization_id", userBean.getOrgCode())
.eq("modularid", 7).eq(r != null && r > -1, "releasestate", r) .eq("modularid", 7).eq(r != null && r > -1, "releasestate", r)
.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);
List<CmsContent> cmsContents = cmsContentPage.getRecords(); List<CmsContent> cmsContents = cmsContentPage.getRecords();
cmsContentPage.getCurrent(); cmsContentPage.getCurrent();
cmsContentPage.getPages(); cmsContentPage.getPages();
cmsContentPage.getTotal(); cmsContentPage.getTotal();
cmsContentPage.getSize(); cmsContentPage.getSize();
return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功"); return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功");
} }
/** /**
* 根据id查讯息 * 根据id查讯息
* *
* @param id * @param id
* @return * @return
*/ */
@GetMapping(value = "/returnpath") @GetMapping(value = "/returnpath")
@ApiOperation(value = "根据id查讯息", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "根据id查讯息", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> returnPath(@CurrentUser UserBean userBean, @RequestParam Integer id) { public Result<Object> returnPath(@CurrentUser UserBean userBean, @RequestParam Integer id) {
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", id); queryWrapper.eq("id", id);
CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper); CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper);
// String[] f = null; // String[] f = null;
// if (cmsContent != null && cmsContent.getFilepath() != null) { // if (cmsContent != null && cmsContent.getFilepath() != null) {
// f = cmsContent.getFilepath().split(","); // f = cmsContent.getFilepath().split(",");
// } // }
CmsContentDto cmsContentDto = new CmsContentDto(); CmsContentDto cmsContentDto = new CmsContentDto();
BeanUtil.copyProperties(cmsContent, cmsContentDto); BeanUtil.copyProperties(cmsContent, cmsContentDto);
// cmsContentDto.setFilepath(f); // cmsContentDto.setFilepath(f);
return ResultUtil.data(cmsContentDto); return ResultUtil.data(cmsContentDto);
} }
/** /**
* OA审核讯息查询搜索 * OA审核讯息查询搜索
*/ */
@PostMapping(value = "/shxxquery") @PostMapping(value = "/shxxquery")
@ApiOperation(value = "搜索OA讯息审核记录", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "搜索OA讯息审核记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> shxxquery(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) { public Result<Object> shxxquery(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime(); String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime(); String e = qyxxQueryDto.getEndTime();
Integer t = qyxxQueryDto.getModularid(); Integer t = qyxxQueryDto.getModularid();
String q = qyxxQueryDto.getQuery(); String q = qyxxQueryDto.getQuery();
// 分页 // 分页
Page<CmsContent> page = new Page<CmsContent>( Page<CmsContent> page = new Page<CmsContent>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
// 查询条件 // 查询条件
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",
!StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00") !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(!StrUtil.hasBlank(q), wq -> wq.like("userid", q).or().like("author", q).or().like("title", q)) .and(!StrUtil.hasBlank(q), wq -> wq.like("userid", q).or().like("author", q).or().like("title", q))
.orderByDesc("addeddate"); .orderByDesc("addeddate");
IPage<CmsContent> CmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper); IPage<CmsContent> CmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
List<CmsContent> CmsContents = CmsContentPage.getRecords(); List<CmsContent> CmsContents = CmsContentPage.getRecords();
CmsContentPage.getCurrent(); CmsContentPage.getCurrent();
CmsContentPage.getPages(); CmsContentPage.getPages();
CmsContentPage.getTotal(); CmsContentPage.getTotal();
CmsContentPage.getSize(); CmsContentPage.getSize();
return ResultUtil.data(CmsContentPage, CmsContents, "企业OA讯息审核情况搜索成功"); return ResultUtil.data(CmsContentPage, CmsContents, "企业OA讯息审核情况搜索成功");
} }
/** /**
* 讯息发布 * 讯息发布
* *
* @param id * @param id
*/ */
@GetMapping(value = "/qyxxsdfb/{id}") @GetMapping(value = "/qyxxsdfb/{id}")
@ApiOperation(value = "OA讯息手动发布", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "OA讯息手动发布", httpMethod = "GET", notes = "接口发布说明")
public Result<Void> qyxxsdfb(@CurrentUser UserBean userBean, @PathVariable Integer id) { public Result<Void> qyxxsdfb(@CurrentUser UserBean userBean, @PathVariable Integer id) {
// 根据id将状态设为发布 // 根据id将状态设为发布
CmsContent q = new CmsContent(); CmsContent q = new CmsContent();
UpdateWrapper<CmsContent> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CmsContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id); updateWrapper.eq("id", id);
Long now = new Date().getTime();// 时间毫秒数 Long now = new Date().getTime();// 时间毫秒数
q = CmsContent.builder().organizationId(userBean.getOrgCode()).id(id).releasestate(0) q = CmsContent.builder().organizationId(userBean.getOrgCode()).id(id).releasestate(0)
.releasetime(now.toString()).build(); .releasetime(now.toString()).build();
cmsContentMapper.update(q, updateWrapper); cmsContentMapper.update(q, updateWrapper);
return ResultUtil.success("发布成功"); return ResultUtil.success("发布成功");
} }
/** /**
* 讯息收回 * 讯息收回
* *
* @param id * @param id
*/ */
@GetMapping(value = "/qyxxtb/{id}") @GetMapping(value = "/qyxxtb/{id}")
@ApiOperation(value = "OA讯息发布收回", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "OA讯息发布收回", httpMethod = "GET", notes = "接口发布说明")
public Result<Void> takeBack(@CurrentUser UserBean userBean, @PathVariable Integer id) { public Result<Void> takeBack(@CurrentUser UserBean userBean, @PathVariable Integer id) {
// 根据id将状态设为收回 // 根据id将状态设为收回
CmsContent q = new CmsContent(); CmsContent q = new CmsContent();
UpdateWrapper<CmsContent> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CmsContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id); updateWrapper.eq("id", id);
Date now = new Date(); Date now = new Date();
q = CmsContent.builder().organizationId(userBean.getOrgCode()).id(id).releasestate(2) q = CmsContent.builder().organizationId(userBean.getOrgCode()).id(id).releasestate(2)
.takeBack(userBean.getEmpNum()).takeBackTime(now.toString()).build(); .takeBack(userBean.getEmpNum()).takeBackTime(now.toString()).build();
cmsContentMapper.update(q, updateWrapper); cmsContentMapper.update(q, updateWrapper);
return ResultUtil.success("收回成功"); return ResultUtil.success("收回成功");
} }
/** /**
* 添加已读 * 添加已读
* *
* @param userBean * @param userBean
* @return * @return
*/ */
@GetMapping(value = "/isread") @GetMapping(value = "/isread")
@ApiOperation(value = "添加已读人", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "添加已读人", httpMethod = "GET", notes = "接口发布说明")
public Result<Void> isRead(@CurrentUser UserBean userBean, Integer mid) { public Result<Void> isRead(@CurrentUser UserBean userBean, Integer mid) {
Integer empNum = userBean.getEmpNum(); Integer empNum = userBean.getEmpNum();
QueryWrapper<CmsIsRead> q = new QueryWrapper<CmsIsRead>(); QueryWrapper<CmsIsRead> q = new QueryWrapper<CmsIsRead>();
q.eq("mid", mid).eq("uid", empNum); q.eq("mid", mid).eq("uid", empNum);
CmsIsRead cmsIsRead = CmsIsRead.builder().build().selectOne(q); CmsIsRead cmsIsRead = CmsIsRead.builder().build().selectOne(q);
if (!q.equals(null)) { if (!q.equals(null)) {
cmsIsRead.setMid(mid); cmsIsRead.setMid(mid);
cmsIsRead.setUid(empNum); cmsIsRead.setUid(empNum);
cmsIsRead.setReadTime(new Date()); cmsIsRead.setReadTime(new Date());
cmsIsRead.insert(); cmsIsRead.insert();
return ResultUtil.success("添加成功"); return ResultUtil.success("添加成功");
} }
return ResultUtil.success("已存在"); return ResultUtil.success("已存在");
} }
/** /**
* 查询已读人 * 查询已读人
* *
* @param userBean * @param userBean
* @param mid * @param mid
* @return * @return
*/ */
@PostMapping(value = "/qisread") @PostMapping(value = "/qisread")
@ApiOperation(value = "查询讯息已读人", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "查询讯息已读人", httpMethod = "POST", notes = "接口发布说明")
public Result<QyxxIsReadDto> queryIsRead(@CurrentUser UserBean userBean, @RequestBody Integer mid) { public Result<QyxxIsReadDto> queryIsRead(@CurrentUser UserBean userBean, @RequestBody Integer mid) {
QyxxIsReadDto q = cmsIsReadMapper.queryIsReadEmp(userBean.getOrgCode(), mid); QyxxIsReadDto q = cmsIsReadMapper.queryIsReadEmp(userBean.getOrgCode(), mid);
return ResultUtil.data(q, "查询成功"); return ResultUtil.data(q, "查询成功");
} }
/******************* 以下轮播信息 ************************/ /******************* 以下轮播信息 ************************/
/** /**
* 新增/修改轮播信息 * 新增/修改轮播信息
*/ */
@PostMapping(value = "/addCarousel") @PostMapping(value = "/addCarousel")
@ApiOperation(value = "新增轮播信息", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "新增轮播信息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsAnnouncement> addCarousel(@CurrentUser UserBean userBean, public Result<CmsAnnouncement> addCarousel(@CurrentUser UserBean userBean,
@RequestBody CmsAnnouncement cmsAnnouncement) { @RequestBody CmsAnnouncement cmsAnnouncement) {
cmsAnnouncement.setFbrid(userBean.getEmpNum()); cmsAnnouncement.setFbrid(userBean.getEmpNum());
cmsAnnouncement.setFbtime(new Date()); cmsAnnouncement.setFbtime(new Date());
cmsAnnouncement.setOrgCode(userBean.getOrgCode()); cmsAnnouncement.setOrgCode(userBean.getOrgCode());
cmsAnnouncement.insertOrUpdate(); cmsAnnouncement.insertOrUpdate();
return ResultUtil.data(cmsAnnouncement, "新增/修改成功"); return ResultUtil.data(cmsAnnouncement, "新增/修改成功");
} }
/** /**
* 删除轮播信息 * 删除轮播信息
*/ */
@DeleteMapping(value = "/delCarousel/{id}") @DeleteMapping(value = "/delCarousel/{id}")
@ApiOperation(value = "删除轮播信息", httpMethod = "DELETE", notes = "接口发布说明") @ApiOperation(value = "删除轮播信息", httpMethod = "DELETE", notes = "接口发布说明")
public Result<Object> delCarousel(@CurrentUser UserBean userBean, @PathVariable Integer id) { public Result<Object> delCarousel(@CurrentUser UserBean userBean, @PathVariable Integer id) {
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
return ResultUtil.data(CmsAnnouncement.builder().build() return ResultUtil.data(CmsAnnouncement.builder().build()
.delete(new QueryWrapper<CmsAnnouncement>().eq("org_code", orgCode).eq("id", id)), "删除成功"); .delete(new QueryWrapper<CmsAnnouncement>().eq("org_code", orgCode).eq("id", id)), "删除成功");
} }
/** /**
* 查询轮播信息列表 * 查询轮播信息列表
*/ */
@PostMapping(value = "/queryCarousel") @PostMapping(value = "/queryCarousel")
@ApiOperation(value = "查询轮播信息", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "查询轮播信息", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> delCarousel(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) { public Result<Object> delCarousel(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime(); String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime(); String e = qyxxQueryDto.getEndTime();
String q = qyxxQueryDto.getQuery(); String q = qyxxQueryDto.getQuery();
Page<CmsAnnouncement> page = new Page<CmsAnnouncement>( Page<CmsAnnouncement> page = new Page<CmsAnnouncement>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsAnnouncement> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsAnnouncement> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", userBean.getOrgCode()); queryWrapper.eq("org_code", userBean.getOrgCode());
queryWrapper.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "fbtime", queryWrapper.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "fbtime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(e) ? e : "9999-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")
.and(!StrUtil.hasBlank(q), wq -> wq.like("title", q).or().like("fbnr", q)).orderByDesc("fbtime"); .and(!StrUtil.hasBlank(q), wq -> wq.like("title", q).or().like("fbnr", q)).orderByDesc("fbtime");
IPage<CmsAnnouncement> cmsAnnouncementPage = CmsAnnouncement.builder().build().selectPage(page, queryWrapper); IPage<CmsAnnouncement> cmsAnnouncementPage = CmsAnnouncement.builder().build().selectPage(page, queryWrapper);
List<CmsAnnouncement> cmsAnnouncements = cmsAnnouncementPage.getRecords(); List<CmsAnnouncement> cmsAnnouncements = cmsAnnouncementPage.getRecords();
cmsAnnouncementPage.getCurrent(); cmsAnnouncementPage.getCurrent();
cmsAnnouncementPage.getPages(); cmsAnnouncementPage.getPages();
cmsAnnouncementPage.getTotal(); cmsAnnouncementPage.getTotal();
cmsAnnouncementPage.getSize(); cmsAnnouncementPage.getSize();
return ResultUtil.data(cmsAnnouncementPage, cmsAnnouncements, "查询成功"); return ResultUtil.data(cmsAnnouncementPage, cmsAnnouncements, "查询成功");
} }
/** /**
* 查询默认轮播信息 * 查询默认轮播信息
*/ */
@GetMapping(value = "/defaultCarousel") @GetMapping(value = "/defaultCarousel")
@ApiOperation(value = "查询轮播信息(默认)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "查询轮播信息(默认)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> defaultCarousel(@CurrentUser UserBean userBean) { public Result<Object> defaultCarousel(@CurrentUser UserBean userBean) {
return ResultUtil.data( return ResultUtil.data(
CmsAnnouncement.builder().build().selectOne( CmsAnnouncement.builder().build().selectOne(
new QueryWrapper<CmsAnnouncement>().eq("is_default", 1).eq("org_code", userBean.getOrgCode())), new QueryWrapper<CmsAnnouncement>().eq("is_default", 1).eq("org_code", userBean.getOrgCode())),
"查询成功"); "查询成功");
} }
/** /**
* 设置默认 * 设置默认
*/ */
@GetMapping(value = "/default/{id}") @GetMapping(value = "/default/{id}")
@ApiOperation(value = "设置默认轮播信息", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "设置默认轮播信息", httpMethod = "GET", notes = "接口发布说明")
public Result<Void> setDefault(@CurrentUser UserBean userBean, @PathVariable("id") Integer id) { public Result<Void> setDefault(@CurrentUser UserBean userBean, @PathVariable("id") Integer id) {
// 将所有设为非默认 // 将所有设为非默认
boolean cmsAnnouncement = CmsAnnouncement.builder().isDefault(0).build().update( boolean cmsAnnouncement = CmsAnnouncement.builder().isDefault(0).build().update(
new LambdaQueryWrapper<CmsAnnouncement>().eq(CmsAnnouncement::getOrgCode, userBean.getOrgCode())); new LambdaQueryWrapper<CmsAnnouncement>().eq(CmsAnnouncement::getOrgCode, userBean.getOrgCode()));
// 根据id设为默认 // 根据id设为默认
if (cmsAnnouncement) { if (cmsAnnouncement) {
if (CmsAnnouncement.builder().id(id).isDefault(1).build().updateById()) if (CmsAnnouncement.builder().id(id).isDefault(1).build().updateById())
return ResultUtil.success("设置成功"); return ResultUtil.success("设置成功");
else else
return ResultUtil.success("设置失败"); return ResultUtil.success("设置失败");
} }
return ResultUtil.success("设置失败"); return ResultUtil.success("设置失败");
} }
/** /**
* 查询传阅列表 * 查询传阅列表
* @return *
*/ * @return
@PostMapping(value = "/getCmsContentReads") */
@ApiOperation(value = "查询传阅列表", httpMethod = "POST", notes = "接口发布说明") @PostMapping(value = "/getCmsContentReads")
public Result<Object> getCmsContentReads(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) { @ApiOperation(value = "查询传阅列表", httpMethod = "POST", notes = "接口发布说明")
Page<CmsContentRead> page = new Page<CmsContentRead>(cmsContentReadDto.getCurrentPage(), cmsContentReadDto.getTotalPage()); public Result<Object> getCmsContentReads(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) {
//查询传阅列表 Page<CmsContentRead> page = new Page<CmsContentRead>(cmsContentReadDto.getCurrentPage(), cmsContentReadDto.getTotalPage());
IPage<CmsContentRead> cmsContentReads = CmsContentRead.builder().build() //查询传阅列表
.selectPage(page, new QueryWrapper<CmsContentRead>() IPage<CmsContentRead> cmsContentReads = CmsContentRead.builder().build()
.lambda().eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()).orderByDesc(CmsContentRead::getReviewTime)); .selectPage(page, new QueryWrapper<CmsContentRead>()
.lambda().eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()).orderByDesc(CmsContentRead::getReviewTime));
return ResultUtil.data(cmsContentReads);
} return ResultUtil.data(cmsContentReads);
}
/**
* 标记已阅 /**
*/ * 标记已阅
@GetMapping(value = "/haveRead/{id}") */
@ApiOperation(value = "标记已阅", httpMethod = "GET", notes = "接口发布说明") @GetMapping(value = "/haveRead/{id}")
public Result<Object> haveRead(@CurrentUser UserBean userBean, @PathVariable("id") Integer id) { @ApiOperation(value = "标记已阅", httpMethod = "GET", notes = "接口发布说明")
//用户id查询传阅消息 public Result<Object> haveRead(@CurrentUser UserBean userBean, @PathVariable("id") Integer id) {
CmsContentRead cmsContentRead = CmsContentRead.builder().build() //用户id查询传阅消息
.selectOne(new QueryWrapper<CmsContentRead>().lambda() CmsContentRead cmsContentRead = CmsContentRead.builder().build()
.eq(CmsContentRead::getUserId, userBean.getEmpNum()) .selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode()) .eq(CmsContentRead::getUserId, userBean.getEmpNum())
.eq(CmsContentRead::getCmsContentId,id)); .eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
.eq(CmsContentRead::getCmsContentId, id));
if(cmsContentRead == null){
cmsContentRead = new CmsContentRead(); if (cmsContentRead == null) {
cmsContentRead.setUserId(userBean.getEmpNum()); cmsContentRead = new CmsContentRead();
cmsContentRead.setUserName(userBean.getUserInfo().getName()); cmsContentRead.setUserId(userBean.getEmpNum());
cmsContentRead.setOrgCode(userBean.getOrgCode()); cmsContentRead.setUserName(userBean.getUserInfo().getName());
cmsContentRead.setCmsContentId(id); cmsContentRead.setOrgCode(userBean.getOrgCode());
}else { cmsContentRead.setCmsContentId(id);
//已阅 直接返回 } else {
if(cmsContentRead.getReadStatus() == 1){ //已阅 直接返回
return ResultUtil.data(1); if (cmsContentRead.getReadStatus() == 1) {
} return ResultUtil.data(1);
} }
}
try {
cmsContentRead.setReadStatus(1); try {
cmsContentRead.setReviewTime(new Date()); cmsContentRead.setReadStatus(1);
cmsContentRead.insertOrUpdate(); cmsContentRead.setReviewTime(new Date());
}catch (Exception e){ cmsContentRead.insertOrUpdate();
log.error("=============已阅操作失败, " + e); } catch (Exception e) {
return ResultUtil.error(e); log.error("=============已阅操作失败, " + e);
} return ResultUtil.error(e);
return ResultUtil.success(); }
} return ResultUtil.success();
}
/**
* 根据讯息id查传阅列表 /**
* @return * 根据讯息id查传阅列表
*/ *
@PostMapping(value = "/comment") * @return
@ApiOperation(value = "评论意见反馈", httpMethod = "POST", notes = "接口发布说明") */
public Result<Object> comment(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) { @PostMapping(value = "/comment")
//用户id查询传阅消息 @ApiOperation(value = "评论意见反馈", httpMethod = "POST", notes = "接口发布说明")
CmsContentRead cmsContentRead = CmsContentRead.builder().build() public Result<Object> comment(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) {
.selectOne(new QueryWrapper<CmsContentRead>().lambda() //用户id查询传阅消息
.eq(CmsContentRead::getUserId, userBean.getEmpNum()) CmsContentRead cmsContentRead = CmsContentRead.builder().build()
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode()) .selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getCmsContentId,cmsContentReadDto.getCmsContentId())); .eq(CmsContentRead::getUserId, userBean.getEmpNum())
try { .eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
cmsContentRead.setReviewContent(cmsContentReadDto.getReviewContent()); .eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()));
cmsContentRead.insertOrUpdate(); try {
}catch (Exception e){ cmsContentRead.setReviewContent(cmsContentReadDto.getReviewContent());
log.error("=============评论失败, " + e); cmsContentRead.insertOrUpdate();
return ResultUtil.error(e); } catch (Exception e) {
} log.error("=============评论失败, " + e);
return ResultUtil.success(); return ResultUtil.error(e);
} }
/** return ResultUtil.success();
* 根据讯息id查传阅增加文件 }
* @return
*/ /**
@PostMapping(value = "/cmsAddFile") * 根据讯息id查传阅增加文件
@ApiOperation(value = "文件传阅增加文件", httpMethod = "POST", notes = "接口发布说明") *
public Result<Object> cmsAddFile(@CurrentUser UserBean userBean, @RequestBody JSONObject request) { * @return
*/
String cmsContentId=request.getString("cmsContentId"); @PostMapping(value = "/cmsAddFile")
@ApiOperation(value = "文件传阅增加文件", httpMethod = "POST", notes = "接口发布说明")
//用户id查询传阅消息 public Result<Object> cmsAddFile(@CurrentUser UserBean userBean, @RequestBody JSONObject request) {
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", cmsContentId); String cmsContentId = request.getString("cmsContentId");
CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper);
JSONArray addjsonArray=JSONArray.fromObject(request.getString("filepathcms")); //用户id查询传阅消息
JSONArray resjsonArray=JSONArray.fromObject(cmsContent.getFilepath()); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
resjsonArray.addAll(addjsonArray); queryWrapper.eq("id", cmsContentId);
cmsContent.setFilepath(resjsonArray.toString()); CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper);
cmsContentMapper.updateById(cmsContent); JSONArray addjsonArray = JSONArray.fromObject(request.getString("filepathcms"));
return ResultUtil.data(resjsonArray.toString()); JSONArray resjsonArray = JSONArray.fromObject(cmsContent.getFilepath());
} resjsonArray.addAll(addjsonArray);
/** cmsContent.setFilepath(resjsonArray.toString());
* 添加传阅人员 cmsContentMapper.updateById(cmsContent);
* @return return ResultUtil.data(resjsonArray.toString());
*/ }
@PostMapping(value = "/addReadPersonnel")
@ApiOperation(value = "添加传阅人员", httpMethod = "POST", notes = "接口发布说明") /**
public Result<Object> addReadPersonnel(@CurrentUser UserBean userBean, @RequestBody List<CmsContentRead> cmsContentReads) { * 添加传阅人员
for (CmsContentRead ccr:cmsContentReads *
) { * @return
ccr.insert(); */
} @PostMapping(value = "/addReadPersonnel")
return ResultUtil.success(); @ApiOperation(value = "添加传阅人员", httpMethod = "POST", notes = "接口发布说明")
} public Result<Object> addReadPersonnel(@CurrentUser UserBean userBean, @RequestBody List<CmsContentRead> cmsContentReads) {
@PostMapping(value = "/getUnreadCmsList") for (CmsContentRead ccr : cmsContentReads
@ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明") ) {
public Result<Object> shxxquery(@CurrentUser UserBean userBean) { ccr.insert();
return ResultUtil.data(cmsIsReadMapper.getUnreadList(userBean.getEmpNum())); }
} return ResultUtil.success();
}
@PostMapping(value = "/getUnreadCmsList")
@ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> shxxquery(@CurrentUser UserBean userBean) {
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