2023年4月25日 新增推送定时任务

This commit is contained in:
bai 2023-04-25 22:12:37 +08:00
parent 45171b4821
commit 27725554f6
9 changed files with 578 additions and 2 deletions

View File

@ -0,0 +1,75 @@
package org.jeecg.modules.kc.grab.SynchronizationService;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog;
import org.jeecg.modules.kc.kcMessagelistcopy.entity.KcMessagelistcopy;
import org.jeecg.modules.kc.kcMessagelistcopy.service.IKcMessagelistcopyService;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Map;
@Slf4j
public class SyncMessageList extends BaseSync {
@Autowired
private IKcMessagelistcopyService impService;
/**
* 若参数变量名修改 QuartzJobController中也需对应修改
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) {
start();
run(getParamMap());
end();
}
/**
* 有参定时任务实现
* @param param
*/
public void run(Map<String, Object> param){
// int offsetDay = 1;
// if(param != null){
// if(Boolean.parseBoolean((String)param.get("offsetDay"))){
//
// }
// }
//明天
DateTime now = DateUtil.date();
//今天下午
String todayStr = now.toDateStr() + " 16:00";
DateTime nextDate = DateUtil.offset(now, DateField.DAY_OF_MONTH, 1);
String nextStr = nextDate.toDateStr();
int rowNum = impService.insertTx(nextStr,todayStr);
// impService.insertStudentClass(nextStr);
// impService.insertTeacherClass(nextStr);
//
// impService.insertStudentNextDayClass(nextStr,todayStr);
// impService.insertTeacherNextDayClass(nextStr,todayStr);
//保存到胃
// impService.syncList(outDataList);
Xxhbsynclog xxhbsynclog = new Xxhbsynclog();
xxhbsynclog.setSyncRowNum(String.valueOf(rowNum));
saveLog(xxhbsynclog, KcMessagelistcopy.class);
}
/**
* 无参定时任务实现
*/
public void run(){
run(null);
}
}

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map;
@Slf4j
public class SyncTJwTkxx extends BaseSync {
public class SyncTJwTkxx extends BaseSync {
@Autowired
private ITJwTkxxService expService;

View File

@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
@Slf4j
public class SyncTZzbLdxx extends BaseSync {
public class SyncTZzbLdxx extends BaseSync {
@Autowired
private ITZzbLdxxService expService;

View File

@ -0,0 +1,163 @@
package org.jeecg.modules.kc.kcMessagelistcopy.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.kc.kcMessagelistcopy.entity.KcMessagelistcopy;
import org.jeecg.modules.kc.kcMessagelistcopy.service.IKcMessagelistcopyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: 订阅信息表
* @Author: jeecg-boot
* @Date: 2023-04-25
* @Version: V1.0
*/
@Api(tags="订阅信息表")
@RestController
@RequestMapping("/kc/kcMessagelistcopy")
@Slf4j
public class KcMessagelistcopyController extends JeecgController<KcMessagelistcopy, IKcMessagelistcopyService> {
@Autowired
private IKcMessagelistcopyService kcMessagelistcopyService;
/**
* 分页列表查询
*
* @param kcMessagelistcopy
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "订阅信息表-分页列表查询")
@ApiOperation(value="订阅信息表-分页列表查询", notes="订阅信息表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<KcMessagelistcopy>> queryPageList(KcMessagelistcopy kcMessagelistcopy,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<KcMessagelistcopy> queryWrapper = QueryGenerator.initQueryWrapper(kcMessagelistcopy, req.getParameterMap());
Page<KcMessagelistcopy> page = new Page<KcMessagelistcopy>(pageNo, pageSize);
IPage<KcMessagelistcopy> pageList = kcMessagelistcopyService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param kcMessagelistcopy
* @return
*/
@AutoLog(value = "订阅信息表-添加")
@ApiOperation(value="订阅信息表-添加", notes="订阅信息表-添加")
@RequiresPermissions("kc:kc_messagelistcopy:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody KcMessagelistcopy kcMessagelistcopy) {
kcMessagelistcopyService.save(kcMessagelistcopy);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param kcMessagelistcopy
* @return
*/
@AutoLog(value = "订阅信息表-编辑")
@ApiOperation(value="订阅信息表-编辑", notes="订阅信息表-编辑")
@RequiresPermissions("kc:kc_messagelistcopy:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody KcMessagelistcopy kcMessagelistcopy) {
kcMessagelistcopyService.updateById(kcMessagelistcopy);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "订阅信息表-通过id删除")
@ApiOperation(value="订阅信息表-通过id删除", notes="订阅信息表-通过id删除")
@RequiresPermissions("kc:kc_messagelistcopy:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
kcMessagelistcopyService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "订阅信息表-批量删除")
@ApiOperation(value="订阅信息表-批量删除", notes="订阅信息表-批量删除")
@RequiresPermissions("kc:kc_messagelistcopy:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.kcMessagelistcopyService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "订阅信息表-通过id查询")
@ApiOperation(value="订阅信息表-通过id查询", notes="订阅信息表-通过id查询")
@GetMapping(value = "/queryById")
public Result<KcMessagelistcopy> queryById(@RequestParam(name="id",required=true) String id) {
KcMessagelistcopy kcMessagelistcopy = kcMessagelistcopyService.getById(id);
if(kcMessagelistcopy==null) {
return Result.error("未找到对应数据");
}
return Result.OK(kcMessagelistcopy);
}
/**
* 导出excel
*
* @param request
* @param kcMessagelistcopy
*/
@RequiresPermissions("kc:kc_messagelistcopy:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, KcMessagelistcopy kcMessagelistcopy) {
return super.exportXls(request, kcMessagelistcopy, KcMessagelistcopy.class, "订阅信息表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("kc:kc_messagelistcopy:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, KcMessagelistcopy.class);
}
}

View File

@ -0,0 +1,99 @@
package org.jeecg.modules.kc.kcMessagelistcopy.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 订阅信息表
* @Author: jeecg-boot
* @Date: 2023-04-25
* @Version: V1.0
*/
@Data
@TableName("kc_messagelistcopy")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="kc_messagelistcopy对象", description="订阅信息表")
public class KcMessagelistcopy implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**msgid*/
@Excel(name = "msgid", width = 15)
@ApiModelProperty(value = "msgid")
private java.lang.String msgid;
/**touser*/
@Excel(name = "touser", width = 15)
@ApiModelProperty(value = "touser")
private java.lang.String touser;
/**templateId*/
@Excel(name = "templateId", width = 15)
@ApiModelProperty(value = "templateId")
private java.lang.String templateId;
/**tourl*/
@Excel(name = "tourl", width = 15)
@ApiModelProperty(value = "tourl")
private java.lang.String tourl;
/**firstdata*/
@Excel(name = "firstdata", width = 15)
@ApiModelProperty(value = "firstdata")
private java.lang.String firstdata;
/**remarkdata*/
@Excel(name = "remarkdata", width = 15)
@ApiModelProperty(value = "remarkdata")
private java.lang.String remarkdata;
/**keyword1*/
@Excel(name = "keyword1", width = 15)
@ApiModelProperty(value = "keyword1")
private java.lang.String keyword1;
/**keyword2*/
@Excel(name = "keyword2", width = 15)
@ApiModelProperty(value = "keyword2")
private java.lang.String keyword2;
/**keyword3*/
@Excel(name = "keyword3", width = 15)
@ApiModelProperty(value = "keyword3")
private java.lang.String keyword3;
/**keyword4*/
@Excel(name = "keyword4", width = 15)
@ApiModelProperty(value = "keyword4")
private java.lang.String keyword4;
/**keyword5*/
@Excel(name = "keyword5", width = 15)
@ApiModelProperty(value = "keyword5")
private java.lang.String keyword5;
/**mtype*/
@Excel(name = "mtype", width = 15)
@ApiModelProperty(value = "mtype")
private java.lang.String mtype;
/**scheduleddatetime*/
@Excel(name = "scheduleddatetime", width = 15)
@ApiModelProperty(value = "scheduleddatetime")
private java.lang.String scheduleddatetime;
/**status*/
@Excel(name = "status", width = 15)
@ApiModelProperty(value = "status")
private java.lang.String status;
/**sendtime*/
@Excel(name = "sendtime", width = 15)
@ApiModelProperty(value = "sendtime")
private java.lang.String sendtime;
}

View File

@ -0,0 +1,21 @@
package org.jeecg.modules.kc.kcMessagelistcopy.mapper;
import org.jeecg.modules.kc.kcMessagelistcopy.entity.KcMessagelistcopy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 订阅信息表
* @Author: jeecg-boot
* @Date: 2023-04-25
* @Version: V1.0
*/
public interface KcMessagelistcopyMapper extends BaseMapper<KcMessagelistcopy> {
int insertStudentClass(String skrq);
int insertTeacherClass(String skrq);
int insertStudentNextDayClass(String skrq, String txrq);
int insertTeacherNextDayClass(String skrq, String txrq);
}

View File

@ -0,0 +1,141 @@
<?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="org.jeecg.modules.kc.kcMessagelistcopy.mapper.KcMessagelistcopyMapper">
<insert id="insertStudentClass">
INSERT INTO kc_messagelistcopy ( id, touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
0,
bd.openid,
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',
'https://zxkccxwebvpnnenueducn/index',
CONCAT( xk.xm, '同学,您有课程即将开始:' ),
'',
kt.kcmc,
CONCAT( skrq, ' 第', hh, '节' ),
CASE
WHEN skxs = '0' THEN zbfs
WHEN skxs = '1' THEN skdd
WHEN skxs = '2' THEN CONCAT( skdd, '以及', zbfs )
END,
CASE
WHEN hh = '01、02' THEN CONCAT( CURRENT_DATE, ' 07:00' )
WHEN hh = '03、04' THEN CONCAT( CURRENT_DATE, ' 09:00' )
WHEN hh = '05、06' THEN CONCAT( CURRENT_DATE, ' 13:00' )
WHEN hh = '07、08' THEN CONCAT( CURRENT_DATE, ' 15:00' )
WHEN hh = '09、10' THEN CONCAT( CURRENT_DATE, ' 17:00' )
WHEN hh = '11、12' THEN CONCAT( CURRENT_DATE, ' 19:00' )
END
FROM
kc_xuekeduiyingbiao xk,
kc_ketangbiao kt,
kc_kechengtixingdingyue kd,
kc_bdgxbcopy bd
WHERE
xk.rwbh = kt.rwbh
AND xk.xh = kd.userid
AND xk.xh = bd.userid
AND kd.kqtx = 1
AND kt.skrq = #{ skrq }
</insert>
<insert id="insertTeacherClass">
INSERT INTO kc_messagelistcopy ( id, touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
0,
bd.openid,
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',
'https://zxkccx.webvpn.nenu.edu.cn/index',
CONCAT( kt.skjs, '老师,您有课程即将开始:' ),
'',
kcmc,
CONCAT( skrq, ' 第', hh, '节' ),
CASE
WHEN skxs = '0' THEN zbfs
WHEN skxs = '1' THEN skdd
WHEN skxs = '2' THEN CONCAT( skdd, '以及', zbfs )
END,
CASE
WHEN hh = '01、02' THEN CONCAT( CURRENT_DATE, ' 07:00' )
WHEN hh = '03、04' THEN CONCAT( CURRENT_DATE, ' 09:00' )
WHEN hh = '05、06' THEN CONCAT( CURRENT_DATE, ' 13:00' )
WHEN hh = '07、08' THEN CONCAT( CURRENT_DATE, ' 15:00' )
WHEN hh = '09、10' THEN CONCAT( CURRENT_DATE, ' 17:00' )
WHEN hh = '11、12' THEN CONCAT( CURRENT_DATE, ' 19:00' )
END
FROM
kc_kechengtixingdingyue kd,
kc_ketangbiao kt,
kc_bdgxbcopy bd
WHERE
kd.userid = kt.jgh
AND kd.userid = bd.userid
AND kd.kqtx = 1
AND skrq = #{ skrq }
</insert>
<insert id="insertStudentNextDayClass">
INSERT INTO kc_messagelistcopy ( id, touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
0,
bd.openid,
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',
'https://zxkccx.webvpn.nenu.edu.cn/index',
CONCAT( xk.xm, '同学,您明天的课程安排如下:' ),
'',
concat( '2022-12-20',
CASE
WHEN kt.WEEK = '1' THEN ' 星期一'
WHEN kt.WEEK = '2' THEN ' 星期二'
WHEN kt.WEEK = '3' THEN ' 星期三'
WHEN kt.WEEK = '4' THEN ' 星期四'
WHEN kt.WEEK = '5' THEN ' 星期五'
WHEN kt.WEEK = '6' THEN ' 星期六'
WHEN kt.WEEK = '7' THEN ' 星期日'
END
),
GROUP_CONCAT( ' 第', hh, '节', kt.kcmc ),
'',
#{ txrq }
FROM
kc_kechengtixingdingyue kd,
kc_xuekeduiyingbiao xk,
kc_ketangbiao kt,
kc_bdgxbcopy bd
WHERE
kd.userid = xk.xh
AND xk.rwbh = kt.rwbh
AND xk.xh = bd.userid
AND kd.mrkctx = 1
AND skrq = #{ skrq }
GROUP BY bd.openid, xk.xm, WEEK
</insert>
<insert id="insertTeacherNextDayClass">
INSERT INTO kc_messagelistcopy ( id, touser, template_id, tourl, firstdata, remarkdata, keyword1, keyword2, keyword3, scheduleddatetime ) SELECT
0,
bd.openid,
'KtWw0lwQ8FOgJdKgrmya0eoafGkMfMN8ECdZs8oSJys',
'https://zxkccx.webvpn.nenu.edu.cn/index',
CONCAT( kt.skjs, '老师,您明天的课程安排如下:' ),
'',
concat( '2022-12-20',
CASE
WHEN WEEK = '1' THEN ' 星期一'
WHEN WEEK = '2' THEN ' 星期二'
WHEN WEEK = '3' THEN ' 星期三'
WHEN WEEK = '4' THEN ' 星期四'
WHEN WEEK = '5' THEN ' 星期五'
WHEN WEEK = '6' THEN ' 星期六'
WHEN WEEK = '7' THEN ' 星期日'
END
),
GROUP_CONCAT( ' 第', hh, '节', kt.kcmc ),
'',
#{ txrq }
FROM
kc_kechengtixingdingyue kd,
kc_ketangbiao kt,
kc_bdgxbcopy bd
WHERE
kd.userid = kt.jgh
AND kd.userid = bd.userid
AND kd.mrkctx = 1
AND skrq = #{ skrq }
GROUP BY bd.openid, kt.skjs, WEEK
</insert>
</mapper>

View File

@ -0,0 +1,30 @@
package org.jeecg.modules.kc.kcMessagelistcopy.service;
import org.jeecg.modules.kc.kcMessagelistcopy.entity.KcMessagelistcopy;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* @Description: 订阅信息表
* @Author: jeecg-boot
* @Date: 2023-04-25
* @Version: V1.0
*/
public interface IKcMessagelistcopyService extends IService<KcMessagelistcopy> {
int insertTx(String skrq, String txrq);
//写入学生课前提醒
int insertStudentClass(String skrq);
//写入教师课前提醒
int insertTeacherClass(String skrq);
//学生明日课程提醒
int insertStudentNextDayClass(String skrq, String txrq);
//教师明日课程提醒
int insertTeacherNextDayClass(String skrq, String txrq);
}

View File

@ -0,0 +1,47 @@
package org.jeecg.modules.kc.kcMessagelistcopy.service.impl;
import org.jeecg.modules.kc.kcMessagelistcopy.entity.KcMessagelistcopy;
import org.jeecg.modules.kc.kcMessagelistcopy.mapper.KcMessagelistcopyMapper;
import org.jeecg.modules.kc.kcMessagelistcopy.service.IKcMessagelistcopyService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 订阅信息表
* @Author: jeecg-boot
* @Date: 2023-04-25
* @Version: V1.0
*/
@Service
public class KcMessagelistcopyServiceImpl extends ServiceImpl<KcMessagelistcopyMapper, KcMessagelistcopy> implements IKcMessagelistcopyService {
@Override
public int insertTx(String skrq, String txrq) {
int rowNum = 0;
rowNum += insertStudentClass(skrq);
rowNum += insertTeacherClass(skrq);
rowNum += insertStudentNextDayClass(skrq,txrq);
rowNum += insertTeacherNextDayClass(skrq,txrq);
return rowNum;
}
@Override
public int insertStudentClass(String skrq) {
return baseMapper.insertStudentClass(skrq);
}
@Override
public int insertTeacherClass(String skrq) {
return baseMapper.insertTeacherClass(skrq);
}
@Override
public int insertStudentNextDayClass(String skrq, String txrq) {
return baseMapper.insertStudentNextDayClass(skrq,txrq);
}
@Override
public int insertTeacherNextDayClass(String skrq, String txrq) {
return baseMapper.insertTeacherNextDayClass(skrq,txrq);
}
}