
16 changed files with 608 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNotice extends BaseEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 8324297245354558865L; |
||||
|
@ApiModelProperty("标题") |
||||
|
private String title; |
||||
|
@ApiModelProperty("有效期至") |
||||
|
private String validityDate; |
||||
|
@ApiModelProperty("类别") |
||||
|
private String type; |
||||
|
@ApiModelProperty("类别key") |
||||
|
private String typeKey; |
||||
|
@ApiModelProperty("是否置顶") |
||||
|
private String topping; |
||||
|
@ApiModelProperty("内容") |
||||
|
private String content; |
||||
|
@ApiModelProperty("附件") |
||||
|
private String files; |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticeDetailsVo { |
||||
|
|
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("标题") |
||||
|
private String title; |
||||
|
@ApiModelProperty("有效期至") |
||||
|
private String validityDate; |
||||
|
@ApiModelProperty("类别") |
||||
|
private String type; |
||||
|
@ApiModelProperty("类别key") |
||||
|
private String typeKey; |
||||
|
@ApiModelProperty("是否置顶") |
||||
|
private String topping; |
||||
|
@ApiModelProperty("内容") |
||||
|
private String content; |
||||
|
@ApiModelProperty("附件") |
||||
|
private List<UrlQuery> filesList = new ArrayList<>(); |
||||
|
|
||||
|
private String createTime; |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticeDto implements Dto { |
||||
|
private static final long serialVersionUID = 8074080443156103663L; |
||||
|
|
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("标题") |
||||
|
private String title; |
||||
|
@ApiModelProperty("有效期至") |
||||
|
private String validityDate; |
||||
|
@ApiModelProperty("类别") |
||||
|
private String type; |
||||
|
@ApiModelProperty("类别key") |
||||
|
private String typeKey; |
||||
|
@ApiModelProperty("是否置顶") |
||||
|
private String topping; |
||||
|
@ApiModelProperty("内容") |
||||
|
private String content; |
||||
|
@ApiModelProperty("附件") |
||||
|
private List<UrlQuery> filesList = new ArrayList<>(); |
||||
|
|
||||
|
private String createTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Api(tags = "通知公告") |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-portal-SysNotice", |
||||
|
name = "anrui-portal", |
||||
|
path = "v1/SysNotice", |
||||
|
fallback = SysNoticeFeignFallback.class) |
||||
|
public interface SysNoticeFeign { |
||||
|
|
||||
|
@ApiOperation("分页列表") |
||||
|
@PostMapping("/listPage") |
||||
|
ResultBean<PagerVo<SysNoticeVo>> listPage(@RequestBody PagerQuery<SysNoticeQuery> pagerQuery); |
||||
|
|
||||
|
@ApiOperation("新增修改保存") |
||||
|
@PostMapping("/saveOrUpdate") |
||||
|
ResultBean saveOrUpdate(@RequestBody SysNoticeDto dto); |
||||
|
|
||||
|
@ApiOperation("初始化") |
||||
|
@GetMapping("/getDetails") |
||||
|
ResultBean<SysNoticeDetailsVo> getDetails(@RequestParam("sid") String sid); |
||||
|
|
||||
|
@ApiOperation("开启关闭:1是开启,2是关闭") |
||||
|
@PostMapping("/setState") |
||||
|
ResultBean setState(@RequestBody SysNoticesQuery query); |
||||
|
|
||||
|
@ApiOperation("置顶是,取消置顶否") |
||||
|
@PostMapping("/setTopping") |
||||
|
ResultBean setTopping(@RequestBody SysNoticessQuery query); |
||||
|
|
||||
|
@ApiOperation("首页通知公告") |
||||
|
@GetMapping("/getLists") |
||||
|
ResultBean<List<SysNoticeListVo>> getLists(); |
||||
|
|
||||
|
@ApiOperation("删除/批量删除") |
||||
|
@DeleteMapping("/delBySids") |
||||
|
ResultBean delBySids(@RequestBody String[] sids); |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Component |
||||
|
public class SysNoticeFeignFallback { |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticeListVo { |
||||
|
|
||||
|
private String sid; |
||||
|
private String title; |
||||
|
private String createTime; |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticeQuery implements Query { |
||||
|
private static final long serialVersionUID = -2087301472856056824L; |
||||
|
@ApiModelProperty("标题") |
||||
|
private String title; |
||||
|
@ApiModelProperty("发布时间开始") |
||||
|
private String createDateStart; |
||||
|
@ApiModelProperty("发布时间结束") |
||||
|
private String createDateEnd; |
||||
|
@ApiModelProperty("是否置顶") |
||||
|
private String topping; |
||||
|
@ApiModelProperty("开启1,关闭2") |
||||
|
private String state; |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticeVo { |
||||
|
private String sid; |
||||
|
@ApiModelProperty("标题") |
||||
|
private String title; |
||||
|
@ApiModelProperty("发布时间") |
||||
|
private String createDate; |
||||
|
@ApiModelProperty("有效期至") |
||||
|
private String validityDate; |
||||
|
@ApiModelProperty("状态") |
||||
|
private String stateValue; |
||||
|
@ApiModelProperty("是否置顶") |
||||
|
private String topping; |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticesQuery { |
||||
|
|
||||
|
@ApiModelProperty("sids") |
||||
|
private List<String> sidsList = new ArrayList<>(); |
||||
|
@ApiModelProperty("1开启、2关闭") |
||||
|
private String state; |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SysNoticessQuery { |
||||
|
|
||||
|
@ApiModelProperty("sids") |
||||
|
private List<String> sidsList = new ArrayList<>(); |
||||
|
@ApiModelProperty("置顶是、取消置顶否") |
||||
|
private String topping; |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.yxt.anrui.portal.api.sysnotice; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/31 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class UrlQuery { |
||||
|
|
||||
|
private String url; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.anrui.portal.biz.sysnotice; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.anrui.portal.api.sysnotice.SysNotice; |
||||
|
import com.yxt.anrui.portal.api.sysnotice.SysNoticeListVo; |
||||
|
import com.yxt.anrui.portal.api.sysnotice.SysNoticeVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Mapper |
||||
|
public interface SysNoticeMapper extends BaseMapper<SysNotice> { |
||||
|
IPage<SysNoticeVo> selectPageVo(IPage<SysNotice> page, @Param(Constants.WRAPPER) QueryWrapper<SysNotice> qw); |
||||
|
|
||||
|
List<SysNoticeListVo> getLists(); |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.anrui.portal.biz.sysnotice.SysNoticeMapper"> |
||||
|
<select id="selectPageVo" resultType="com.yxt.anrui.portal.api.sysnotice.SysNoticeVo"> |
||||
|
select sn.sid,sn.title, |
||||
|
DATE_FORMAT(sn.createTime, '%Y-%m-%d') as createDate, |
||||
|
sn.validityDate, |
||||
|
case state |
||||
|
when 1 |
||||
|
then '开启' |
||||
|
when 2 then '关闭' end as stateValue, |
||||
|
sn.topping |
||||
|
from sys_notice sn |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="getLists" resultType="com.yxt.anrui.portal.api.sysnotice.SysNoticeListVo"> |
||||
|
select sid, title, DATE_FORMAT(createTime, '%Y-%m-%d') as createTime |
||||
|
from sys_notice |
||||
|
where state = 1 and (validityDate is null or validityDate = '' or validityDate>NOW()) |
||||
|
order by topping desc, createTime desc |
||||
|
limit 4 |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,63 @@ |
|||||
|
package com.yxt.anrui.portal.biz.sysnotice; |
||||
|
|
||||
|
import com.yxt.anrui.portal.api.sysnotice.*; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Api(tags = "通知公告") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/SysNotice") |
||||
|
public class SysNoticeRest implements SysNoticeFeign { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysNoticeService sysNoticeService; |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<PagerVo<SysNoticeVo>> listPage(PagerQuery<SysNoticeQuery> pagerQuery) { |
||||
|
ResultBean<PagerVo<SysNoticeVo>> rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysNoticeVo> pv = sysNoticeService.listPageVo(pagerQuery); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean saveOrUpdate(SysNoticeDto dto) { |
||||
|
return sysNoticeService.saveOrUpdateNotice(dto); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<SysNoticeDetailsVo> getDetails(String sid) { |
||||
|
return sysNoticeService.getDetails(sid); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean setState(SysNoticesQuery query) { |
||||
|
return sysNoticeService.setState(query); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean setTopping(SysNoticessQuery query) { |
||||
|
return sysNoticeService.setTopping(query); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<List<SysNoticeListVo>> getLists() { |
||||
|
return sysNoticeService.getLists(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean delBySids(String[] sids) { |
||||
|
return sysNoticeService.delAllBySids(sids); |
||||
|
} |
||||
|
} |
@ -0,0 +1,175 @@ |
|||||
|
package com.yxt.anrui.portal.biz.sysnotice; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.anrui.portal.api.sysnotice.*; |
||||
|
import com.yxt.anrui.riskcenter.api.loantemplate.LoanTemplate; |
||||
|
import com.yxt.common.base.config.component.FileUploadComponent; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/30 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class SysNoticeService extends MybatisBaseService<SysNoticeMapper, SysNotice> { |
||||
|
|
||||
|
@Autowired |
||||
|
private FileUploadComponent fileUploadComponent; |
||||
|
|
||||
|
public PagerVo<SysNoticeVo> listPageVo(PagerQuery<SysNoticeQuery> pagerQuery) { |
||||
|
SysNoticeQuery query = pagerQuery.getParams(); |
||||
|
QueryWrapper<SysNotice> qw = new QueryWrapper<>(); |
||||
|
if (query != null) { |
||||
|
qw.eq("1", 1); |
||||
|
//标题
|
||||
|
if (StringUtils.isNotBlank(query.getTitle())) { |
||||
|
qw.like("sn.title", query.getTitle()); |
||||
|
} |
||||
|
qw.apply(StringUtils.isNotBlank(query.getCreateDateStart()), "date_format (sn.createTime,'%Y-%m-%d') >= date_format('" + query.getCreateDateStart() + "','%Y-%m-%d')"). |
||||
|
apply(StringUtils.isNotBlank(query.getCreateDateEnd()), "date_format (sn.createTime,'%Y-%m-%d') <= date_format('" + query.getCreateDateEnd() + "','%Y-%m-%d')" |
||||
|
); |
||||
|
if (StringUtils.isNotBlank(query.getTopping())) { |
||||
|
qw.like("sn.topping", query.getTopping()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getState())) { |
||||
|
qw.eq("sn.state", query.getState()); |
||||
|
} |
||||
|
qw.orderByDesc("sn.createTime"); |
||||
|
} |
||||
|
IPage<SysNotice> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
IPage<SysNoticeVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysNoticeVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public ResultBean saveOrUpdateNotice(SysNoticeDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String sid = dto.getSid(); |
||||
|
if (StringUtils.isBlank(sid)) { |
||||
|
SysNotice sysNotice = new SysNotice(); |
||||
|
BeanUtil.copyProperties(dto, sysNotice, "sid"); |
||||
|
List<UrlQuery> filss = dto.getFilesList(); |
||||
|
filss.removeAll(Collections.singleton(null)); |
||||
|
if (!filss.isEmpty()) { |
||||
|
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList()); |
||||
|
filesList.removeAll(Collections.singleton(null)); |
||||
|
if (!filesList.isEmpty()) { |
||||
|
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), ""); |
||||
|
sysNotice.setFiles(files); |
||||
|
} |
||||
|
} |
||||
|
baseMapper.insert(sysNotice); |
||||
|
} else { |
||||
|
SysNotice sysNotice = fetchBySid(sid); |
||||
|
if (sysNotice == null) { |
||||
|
return rb.setMsg("该通知公告不存在"); |
||||
|
} |
||||
|
BeanUtil.copyProperties(dto, sysNotice, "sid"); |
||||
|
List<UrlQuery> filss = dto.getFilesList(); |
||||
|
filss.removeAll(Collections.singleton(null)); |
||||
|
if (!filss.isEmpty()) { |
||||
|
List<String> filesList = filss.stream().map(v -> v.getUrl()).collect(Collectors.toList()); |
||||
|
filesList.removeAll(Collections.singleton(null)); |
||||
|
if (!filesList.isEmpty()) { |
||||
|
String files = String.join(",", filesList).replaceAll(fileUploadComponent.getUrlPrefix(), ""); |
||||
|
sysNotice.setFiles(files); |
||||
|
} |
||||
|
} else { |
||||
|
sysNotice.setFiles(""); |
||||
|
} |
||||
|
baseMapper.updateById(sysNotice); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<SysNoticeDetailsVo> getDetails(String sid) { |
||||
|
ResultBean<SysNoticeDetailsVo> rb = ResultBean.fireFail(); |
||||
|
SysNoticeDetailsVo sysNoticeDetailsVo = new SysNoticeDetailsVo(); |
||||
|
SysNotice sysNotice = fetchBySid(sid); |
||||
|
if (sysNotice == null) { |
||||
|
return rb.setMsg("该通知公告不存在"); |
||||
|
} |
||||
|
BeanUtil.copyProperties(sysNotice, sysNoticeDetailsVo); |
||||
|
sysNoticeDetailsVo.setCreateTime(DateUtil.format(sysNotice.getCreateTime(), "yyyy-MM-dd")); |
||||
|
String filesss = sysNotice.getFiles(); |
||||
|
List<UrlQuery> lists = new ArrayList<>(); |
||||
|
if (StringUtils.isNotBlank(filesss)) { |
||||
|
List<String> fileList = Arrays.asList(filesss.split(",")).stream().map(c -> fileUploadComponent.getUrlPrefix() + c).collect(Collectors.toList()); |
||||
|
for (int i = 0; i < fileList.size(); i++) { |
||||
|
UrlQuery urlQuery = new UrlQuery(); |
||||
|
urlQuery.setUrl(fileList.get(i)); |
||||
|
lists.add(urlQuery); |
||||
|
} |
||||
|
sysNoticeDetailsVo.setFilesList(lists); |
||||
|
} |
||||
|
return rb.success().setData(sysNoticeDetailsVo); |
||||
|
} |
||||
|
|
||||
|
public ResultBean setState(SysNoticesQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<String> sidsList = query.getSidsList(); |
||||
|
sidsList.removeAll(Collections.singleton(null)); |
||||
|
if (sidsList.isEmpty()) { |
||||
|
return rb.setMsg("请选择数据"); |
||||
|
} |
||||
|
String state = query.getState(); |
||||
|
for (String sid : sidsList) { |
||||
|
SysNotice sysNotice = fetchBySid(sid); |
||||
|
if (sysNotice == null) { |
||||
|
return rb.setMsg("操作的数据中包含不存在的数据,请刷新后操作"); |
||||
|
} |
||||
|
sysNotice.setState(Integer.valueOf(state).intValue()); |
||||
|
baseMapper.updateById(sysNotice); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysNoticeListVo>> getLists() { |
||||
|
ResultBean<List<SysNoticeListVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysNoticeListVo> list = baseMapper.getLists(); |
||||
|
list.removeAll(Collections.singleton(null)); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
public ResultBean delAllBySids(String[] sids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
delBySids(sids); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
|
||||
|
public ResultBean setTopping(SysNoticessQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<String> sidsList = query.getSidsList(); |
||||
|
sidsList.removeAll(Collections.singleton(null)); |
||||
|
if (sidsList.isEmpty()) { |
||||
|
return rb.setMsg("请选择数据"); |
||||
|
} |
||||
|
String topping = query.getTopping(); |
||||
|
for (String sid : sidsList) { |
||||
|
SysNotice sysNotice = fetchBySid(sid); |
||||
|
if (sysNotice == null) { |
||||
|
return rb.setMsg("操作的数据中包含不存在的数据,请刷新后操作"); |
||||
|
} |
||||
|
sysNotice.setTopping(topping); |
||||
|
baseMapper.updateById(sysNotice); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue