任务同步会员心得

This commit is contained in:
zhanglipeng 2021-04-06 18:31:35 +08:00
parent 37972c062a
commit 56547aabcc
12 changed files with 629 additions and 5 deletions

View File

@ -1,5 +1,9 @@
package com.ruoyi.framework.task;
import com.ruoyi.project.benyi.domain.BySchoolNews;
import com.ruoyi.project.benyi.service.IBySchoolNewsService;
import com.ruoyi.project.bysite.domain.ByNews;
import com.ruoyi.project.bysite.service.IByNewsService;
import com.ruoyi.project.common.SchoolCommon;
import com.ruoyi.project.system.domain.BySchool;
import com.ruoyi.project.system.domain.SysDept;
@ -30,6 +34,10 @@ public class RyTask {
private ISysDeptService deptService;
@Autowired
private ISysUserService userService;
@Autowired
private IBySchoolNewsService iBySchoolNewsService;
@Autowired
private IByNewsService iByNewsService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@ -73,6 +81,35 @@ public class RyTask {
}
}
}
} else if (params.equals("hyxd")) {
System.out.println("1111");
BySchoolNews bySchoolNews = new BySchoolNews();
bySchoolNews.setIscheck("1");
bySchoolNews.setIsdel("N");
bySchoolNews.setIstb("0");
List<BySchoolNews> list = iBySchoolNewsService.selectAllBySchoolNewsList(bySchoolNews);
if (list != null && list.size() > 0) {
ByNews byNews = null;
BySchoolNews newBySchoolNews = null;
for (int i = 0; i < list.size(); i++) {
byNews = new ByNews();
byNews.setTitle(list.get(i).getTitle());
byNews.setType("03");//会员心得
byNews.setContent(list.get(i).getContent());
byNews.setIsthirdparty("N");
byNews.setIsrelease("Y");
byNews.setIsdel("0");
byNews.setSchoolid(list.get(i).getDeptId());
byNews.setCreateTime(list.get(i).getCreateTime());
byNews.setAbstractcontent(list.get(i).getAbstractcontent());
iByNewsService.insertByNews(byNews);
newBySchoolNews = new BySchoolNews();
newBySchoolNews.setId(list.get(i).getId());
newBySchoolNews.setIstb("1");
iBySchoolNewsService.updateBySchoolNews(newBySchoolNews);
}
}
}
System.out.println("执行有参方法:" + params);
}

View File

@ -102,6 +102,8 @@ public class BySchoolNews extends BaseEntity {
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date checkTime;
private String istb;
public void setId(Long id) {
this.id = id;
}
@ -206,6 +208,14 @@ public class BySchoolNews extends BaseEntity {
return checkTime;
}
public String getIstb() {
return istb;
}
public void setIstb(String istb) {
this.istb = istb;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -223,6 +233,7 @@ public class BySchoolNews extends BaseEntity {
.append("ischeck", getIscheck())
.append("checkuserid", getCheckuserid())
.append("checkTime", getCheckTime())
.append("istb", getIstb())
.toString();
}

View File

@ -27,6 +27,14 @@ public interface BySchoolNewsMapper
*/
public List<BySchoolNews> selectBySchoolNewsList(BySchoolNews bySchoolNews);
/**
* 查询新闻中心列表
*
* @param bySchoolNews 新闻中心
* @return 新闻中心集合
*/
public List<BySchoolNews> selectAllBySchoolNewsList(BySchoolNews bySchoolNews);
/**
* 新增新闻中心
*

View File

@ -27,6 +27,14 @@ public interface IBySchoolNewsService
*/
public List<BySchoolNews> selectBySchoolNewsList(BySchoolNews bySchoolNews);
/**
* 查询新闻中心列表
*
* @param bySchoolNews 新闻中心
* @return 新闻中心集合
*/
public List<BySchoolNews> selectAllBySchoolNewsList(BySchoolNews bySchoolNews);
/**
* 新增新闻中心
*

View File

@ -46,6 +46,18 @@ public class BySchoolNewsServiceImpl implements IBySchoolNewsService
return bySchoolNewsMapper.selectBySchoolNewsList(bySchoolNews);
}
/**
* 查询新闻中心列表
*
* @param bySchoolNews 新闻中心
* @return 新闻中心
*/
@Override
public List<BySchoolNews> selectAllBySchoolNewsList(BySchoolNews bySchoolNews)
{
return bySchoolNewsMapper.selectAllBySchoolNewsList(bySchoolNews);
}
/**
* 新增新闻中心
*

View File

@ -0,0 +1,201 @@
package com.ruoyi.project.bysite.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
/**
* 新闻中心对象 by_news
*
* @author tsbz
* @date 2020-06-28
*/
public class ByNews extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
private Long id;
/**
* 标题
*/
@Excel(name = "标题")
private String title;
/**
* 封面图片
*/
@Excel(name = "封面图片")
private String imgurl;
/**
* 类型
*/
@Excel(name = "类型")
private String type;
/**
* 内容
*/
@Excel(name = "内容")
private String content;
/**
* 创建人
*/
@Excel(name = "创建人")
private Long createuserid;
/**
* 是否第三方平台资源
*/
@Excel(name = "是否第三方平台资源")
private String isthirdparty;
/**
* 第三方路径
*/
@Excel(name = "第三方路径")
private String url;
/**
* 是否发布
*/
@Excel(name = "是否发布")
private String isrelease;
/**
* 是否删除
*/
@Excel(name = "是否删除")
private String isdel;
/**
* 摘要
*/
@Excel(name = "摘要")
private String abstractcontent;
/**
* 编号
*/
private Long schoolid;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setImgurl(String imgurl) {
this.imgurl = imgurl;
}
public String getImgurl() {
return imgurl;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}
public void setCreateuserid(Long createuserid) {
this.createuserid = createuserid;
}
public Long getCreateuserid() {
return createuserid;
}
public void setIsthirdparty(String isthirdparty) {
this.isthirdparty = isthirdparty;
}
public String getIsthirdparty() {
return isthirdparty;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
public void setIsrelease(String isrelease) {
this.isrelease = isrelease;
}
public String getIsrelease() {
return isrelease;
}
public void setIsdel(String isdel) {
this.isdel = isdel;
}
public String getIsdel() {
return isdel;
}
public void setAbstractcontent(String abstractcontent) {
this.abstractcontent = abstractcontent;
}
public String getAbstractcontent() {
return abstractcontent;
}
public Long getSchoolid() {
return schoolid;
}
public void setSchoolid(Long schoolid) {
this.schoolid = schoolid;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("imgurl", getImgurl())
.append("type", getType())
.append("content", getContent())
.append("createuserid", getCreateuserid())
.append("isthirdparty", getIsthirdparty())
.append("url", getUrl())
.append("isrelease", getIsrelease())
.append("isdel", getIsdel())
.append("createTime", getCreateTime())
.append("abstractcontent", getAbstractcontent())
.append("schoolid", getSchoolid())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.bysite.mapper;
import java.util.List;
import com.ruoyi.project.bysite.domain.ByNews;
/**
* 新闻中心Mapper接口
*
* @author tsbz
* @date 2020-06-28
*/
public interface ByNewsMapper {
/**
* 查询新闻中心
*
* @param id 新闻中心ID
* @return 新闻中心
*/
public ByNews selectByNewsById(Long id);
/**
* 查询新闻中心列表
*
* @param byNews 新闻中心
* @return 新闻中心集合
*/
public List<ByNews> selectByNewsList(ByNews byNews);
/**
* 新增新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
public int insertByNews(ByNews byNews);
/**
* 修改新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
public int updateByNews(ByNews byNews);
/**
* 删除新闻中心
*
* @param id 新闻中心ID
* @return 结果
*/
public int deleteByNewsById(Long id);
/**
* 批量删除新闻中心
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByNewsByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.bysite.service;
import java.util.List;
import com.ruoyi.project.bysite.domain.ByNews;
/**
* 新闻中心Service接口
*
* @author tsbz
* @date 2020-06-28
*/
public interface IByNewsService {
/**
* 查询新闻中心
*
* @param id 新闻中心ID
* @return 新闻中心
*/
public ByNews selectByNewsById(Long id);
/**
* 查询新闻中心列表
*
* @param byNews 新闻中心
* @return 新闻中心集合
*/
public List<ByNews> selectByNewsList(ByNews byNews);
/**
* 新增新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
public int insertByNews(ByNews byNews);
/**
* 修改新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
public int updateByNews(ByNews byNews);
/**
* 批量删除新闻中心
*
* @param ids 需要删除的新闻中心ID
* @return 结果
*/
public int deleteByNewsByIds(Long[] ids);
/**
* 删除新闻中心信息
*
* @param id 新闻中心ID
* @return 结果
*/
public int deleteByNewsById(Long id);
}

View File

@ -0,0 +1,92 @@
package com.ruoyi.project.bysite.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.bysite.mapper.ByNewsMapper;
import com.ruoyi.project.bysite.domain.ByNews;
import com.ruoyi.project.bysite.service.IByNewsService;
/**
* 新闻中心Service业务层处理
*
* @author tsbz
* @date 2020-06-28
*/
@Service
@DataSource(value = DataSourceType.SLAVE)
public class ByNewsServiceImpl implements IByNewsService {
@Autowired
private ByNewsMapper byNewsMapper;
/**
* 查询新闻中心
*
* @param id 新闻中心ID
* @return 新闻中心
*/
@Override
public ByNews selectByNewsById(Long id) {
return byNewsMapper.selectByNewsById(id);
}
/**
* 查询新闻中心列表
*
* @param byNews 新闻中心
* @return 新闻中心
*/
@Override
public List<ByNews> selectByNewsList(ByNews byNews) {
return byNewsMapper.selectByNewsList(byNews);
}
/**
* 新增新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
@Override
public int insertByNews(ByNews byNews) {
byNews.setCreateTime(DateUtils.getNowDate());
return byNewsMapper.insertByNews(byNews);
}
/**
* 修改新闻中心
*
* @param byNews 新闻中心
* @return 结果
*/
@Override
public int updateByNews(ByNews byNews) {
return byNewsMapper.updateByNews(byNews);
}
/**
* 批量删除新闻中心
*
* @param ids 需要删除的新闻中心ID
* @return 结果
*/
@Override
public int deleteByNewsByIds(Long[] ids) {
return byNewsMapper.deleteByNewsByIds(ids);
}
/**
* 删除新闻中心信息
*
* @param id 新闻中心ID
* @return 结果
*/
@Override
public int deleteByNewsById(Long id) {
return byNewsMapper.deleteByNewsById(id);
}
}

View File

@ -15,10 +15,10 @@ spring:
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
enabled: true
url: jdbc:mysql://120.53.14.147:3306/benyi-web-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: tsbz2020!
# 初始连接数
initialSize: 5
# 最小连接池数量

View File

@ -19,10 +19,11 @@
<result property="ischeck" column="ischeck"/>
<result property="checkuserid" column="checkuserid"/>
<result property="checkTime" column="check_time"/>
<result property="istb" column="istb"/>
</resultMap>
<sql id="selectBySchoolNewsVo">
select d.id, d.title, d.imgurl, d.abstractcontent, d.type, d.content, d.isdel, d.createuserid, d.create_time, d.dept_id, d.istop, d.ischeck, d.checkuserid, d.check_time from by_school_news d
select d.id, d.title, d.imgurl, d.abstractcontent, d.type, d.content, d.isdel, d.createuserid, d.create_time, d.dept_id, d.istop, d.ischeck, d.checkuserid, d.check_time, d.istb from by_school_news d
</sql>
<select id="selectBySchoolNewsList" parameterType="BySchoolNews" resultMap="BySchoolNewsResult">
@ -40,11 +41,31 @@
<if test="ischeck != null and ischeck != ''">and d.ischeck = #{ischeck}</if>
<if test="checkuserid != null ">and d.checkuserid = #{checkuserid}</if>
<if test="checkTime != null ">and d.check_time = #{checkTime}</if>
<if test="istb != null and istb != ''">and d.istb = #{istb}</if>
</where>
<!-- 数据范围过滤 -->
${dataScope}
</select>
<select id="selectAllBySchoolNewsList" parameterType="BySchoolNews" resultMap="BySchoolNewsResult">
<include refid="selectBySchoolNewsVo"/>
<where>
d.isdel = 'N'
<if test="title != null and title != ''">and d.title like concat('%', #{title}, '%')</if>
<if test="imgurl != null and imgurl != ''">and d.imgurl = #{imgurl}</if>
<if test="abstractcontent != null and abstractcontent != ''">and d.abstractcontent = #{abstractcontent}</if>
<if test="type != null and type != ''">and d.type = #{type}</if>
<if test="content != null and content != ''">and d.content = #{content}</if>
<if test="createuserid != null ">and d.createuserid = #{createuserid}</if>
<if test="deptId != null ">and d.dept_id = #{deptId}</if>
<if test="istop != null and istop != ''">and d.istop = #{istop}</if>
<if test="ischeck != null and ischeck != ''">and d.ischeck = #{ischeck}</if>
<if test="checkuserid != null ">and d.checkuserid = #{checkuserid}</if>
<if test="checkTime != null ">and d.check_time = #{checkTime}</if>
<if test="istb != null and istb != ''">and d.istb = #{istb}</if>
</where>
</select>
<select id="selectBySchoolNewsById" parameterType="Long" resultMap="BySchoolNewsResult">
<include refid="selectBySchoolNewsVo"/>
where d.id = #{id}
@ -100,6 +121,7 @@
<if test="ischeck != null and ischeck != ''">ischeck = #{ischeck},</if>
<if test="checkuserid != null ">checkuserid = #{checkuserid},</if>
<if test="checkTime != null ">check_time = #{checkTime},</if>
<if test="istb != null and istb != ''">istb = #{istb},</if>
</trim>
where id = #{id}
</update>

View File

@ -0,0 +1,111 @@
<?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.ruoyi.project.bysite.mapper.ByNewsMapper">
<resultMap type="ByNews" id="ByNewsResult">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="imgurl" column="imgurl"/>
<result property="type" column="type"/>
<result property="content" column="content"/>
<result property="createuserid" column="createuserid"/>
<result property="isthirdparty" column="isthirdparty"/>
<result property="url" column="url"/>
<result property="isrelease" column="isrelease"/>
<result property="isdel" column="isdel"/>
<result property="createTime" column="create_time"/>
<result property="abstractcontent" column="abstractcontent"/>
<result property="schoolid" column="schoolid"/>
</resultMap>
<sql id="selectByNewsVo">
select id, title, imgurl, type, content, createuserid, isthirdparty, url, isrelease, isdel, create_time, abstractcontent, schoolid from by_news
</sql>
<select id="selectByNewsList" parameterType="ByNews" resultMap="ByNewsResult">
<include refid="selectByNewsVo"/>
<where>
<if test="title != null and title != ''">and title = #{title}</if>
<if test="imgurl != null and imgurl != ''">and imgurl = #{imgurl}</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="content != null and content != ''">and content = #{content}</if>
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
<if test="isthirdparty != null and isthirdparty != ''">and isthirdparty = #{isthirdparty}</if>
<if test="url != null and url != ''">and url = #{url}</if>
<if test="isrelease != null and isrelease != ''">and isrelease = #{isrelease}</if>
<if test="isdel != null and isdel != ''">and isdel = #{isdel}</if>
<if test="abstractcontent != null and abstractcontent != ''">and abstractcontent = #{abstractcontent}</if>
</where>
order by create_time desc
</select>
<select id="selectByNewsById" parameterType="Long" resultMap="ByNewsResult">
<include refid="selectByNewsVo"/>
where id = #{id}
</select>
<insert id="insertByNews" parameterType="ByNews" useGeneratedKeys="true" keyProperty="id">
insert into by_news
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if>
<if test="imgurl != null and imgurl != ''">imgurl,</if>
<if test="type != null and type != ''">type,</if>
<if test="content != null and content != ''">content,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="isthirdparty != null and isthirdparty != ''">isthirdparty,</if>
<if test="url != null and url != ''">url,</if>
<if test="isrelease != null and isrelease != ''">isrelease,</if>
<if test="isdel != null and isdel != ''">isdel,</if>
<if test="createTime != null ">create_time,</if>
<if test="abstractcontent != null and abstractcontent != ''">abstractcontent,</if>
<if test="schoolid != null ">schoolid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if>
<if test="imgurl != null and imgurl != ''">#{imgurl},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="isthirdparty != null and isthirdparty != ''">#{isthirdparty},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="isrelease != null and isrelease != ''">#{isrelease},</if>
<if test="isdel != null and isdel != ''">#{isdel},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="abstractcontent != null and abstractcontent != ''">#{abstractcontent},</if>
<if test="schoolid != null ">#{schoolid},</if>
</trim>
</insert>
<update id="updateByNews" parameterType="ByNews">
update by_news
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="imgurl != null and imgurl != ''">imgurl = #{imgurl},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="isthirdparty != null and isthirdparty != ''">isthirdparty = #{isthirdparty},</if>
<if test="url != null and url != ''">url = #{url},</if>
<if test="isrelease != null and isrelease != ''">isrelease = #{isrelease},</if>
<if test="isdel != null and isdel != ''">isdel = #{isdel},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="abstractcontent != null and abstractcontent != ''">abstractcontent = #{abstractcontent},</if>
<if test="schoolid != null ">schoolid = #{schoolid},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByNewsById" parameterType="Long">
delete from by_news where id = #{id}
</delete>
<delete id="deleteByNewsByIds" parameterType="String">
delete from by_news where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>