集成xxl-job
parent
0210cfc6f3
commit
a9628f681a
5
pom.xml
5
pom.xml
|
|
@ -190,6 +190,11 @@
|
|||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@
|
|||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -120,6 +120,14 @@ public class WxUserController extends BaseController
|
|||
return toAjax(wxUserService.deleteWxUserByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation(ApiTerminal.wxMiniProgram+"根据用户id修改个人数据")
|
||||
@PostMapping(value = "/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editInfo(@RequestBody WxUser wxUser)
|
||||
{
|
||||
return AjaxResult.success(wxUserService.updateWxUser(wxUser));
|
||||
}
|
||||
|
||||
@ApiOperation(ApiTerminal.wxMiniProgram+"根据用户id查询个人中心详情")
|
||||
@PostMapping("/detail/{userId}")
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@ public class CompetitionTeamVsTeamVo extends CompetitionTeamVsTeam {
|
|||
|
||||
@ApiModelProperty(value = "客队logo", required = false)
|
||||
private String guestTeamLogo;
|
||||
@ApiModelProperty(value = "客队队长openid", required = false)
|
||||
private String guestTeamOpenId;
|
||||
|
||||
@ApiModelProperty(value = "主队队长openid", required = false)
|
||||
private String mainTeamOpenId;
|
||||
@ApiModelProperty(value = "中文状态", required = false)
|
||||
private String statusName;
|
||||
@ApiModelProperty(value = "比赛日期", required = false)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
package com.ruoyi.system.job;
|
||||
import com.ruoyi.system.domain.Competition;
|
||||
import com.ruoyi.system.domain.CompetitionTeamVsTeam;
|
||||
import com.ruoyi.system.domain.enums.CompetitionStatusEnum;
|
||||
import com.ruoyi.system.domain.enums.WxAppletsTemplateIdsEnum;
|
||||
import com.ruoyi.system.domain.vo.CompetitionTeamVsTeamVo;
|
||||
import com.ruoyi.system.domain.vo.TemplateDataVo;
|
||||
import com.ruoyi.system.domain.vo.WxMssVo;
|
||||
import com.ruoyi.system.service.ICompetitionService;
|
||||
import com.ruoyi.system.service.ICompetitionTeamVsTeamService;
|
||||
import com.ruoyi.system.service.WxAppletsService;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CompetitionJobHandler {
|
||||
@Resource
|
||||
private ICompetitionService competitionService;
|
||||
|
||||
@Resource
|
||||
private ICompetitionTeamVsTeamService competitionTeamVsTeamService;
|
||||
|
||||
@Resource
|
||||
private WxAppletsService wxAppletsService;
|
||||
|
||||
/** 赛会状态修改
|
||||
* 根据比赛时间修改比赛完成-定时任务
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@XxlJob("competitionFinishJob")
|
||||
public ReturnT<String> execute(String param) throws Exception {
|
||||
competitionService.updateCompetitionFinish();
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据比赛时间修改比赛-队长完成-定时任务
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@XxlJob("competitionVsFinishJob")
|
||||
public ReturnT<String> competitionVsFinishJob(String param) throws Exception {
|
||||
CompetitionTeamVsTeam competitionTeamVsTeam = new CompetitionTeamVsTeam();
|
||||
competitionTeamVsTeamService.competitionVsTeamStatusUpdate(competitionTeamVsTeam);
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
/**
|
||||
* 根据 球队VS球队 推送给队长-定时任务
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@XxlJob("pushScheduleTeamVsTeamJob")
|
||||
public ReturnT<String> pushScheduleTeamVsTeamJob(String param) throws Exception {
|
||||
CompetitionTeamVsTeam competitionTeamVsTeam=new CompetitionTeamVsTeam();
|
||||
competitionTeamVsTeam.setIsDeleted(0);
|
||||
List<CompetitionTeamVsTeamVo> list = competitionTeamVsTeamService.getTodaySchedule(competitionTeamVsTeam);
|
||||
//循环推送消息
|
||||
for (CompetitionTeamVsTeamVo vo : list) {
|
||||
//主队
|
||||
if(!StringUtils.isEmpty(vo)&&!StringUtils.isEmpty(vo.getMainTeamOpenId())) {
|
||||
// Competition competition = competitionService.getById(vo.getCompetitionId());
|
||||
WxMssVo wxMssVo = new WxMssVo();
|
||||
wxMssVo.setTemplate_id(WxAppletsTemplateIdsEnum.COMPETITION_COURSE_REMIND.getCode());
|
||||
wxMssVo.setTouser(vo.getMainTeamOpenId());
|
||||
Map<String, TemplateDataVo> map = new HashMap<>();
|
||||
map.put("thing1", new TemplateDataVo(vo.getMainTeamName()+" VS "+vo.getGuestTeamName()));
|
||||
map.put("thing2", new TemplateDataVo(vo.getCompetitionDate() +" " +vo.getTheTime()));
|
||||
map.put("thing3", new TemplateDataVo(vo.getVsType()));
|
||||
map.put("thing4", new TemplateDataVo("你的球队今天有比赛哦,快去为自己的球队冲榜"));
|
||||
wxMssVo.setData(map);
|
||||
wxAppletsService.pushOneUser(wxMssVo);
|
||||
}
|
||||
//客队
|
||||
if(!StringUtils.isEmpty(vo)&&!StringUtils.isEmpty(vo.getGuestTeamOpenId())) {
|
||||
// Competition competition = competitionService.getById(vo.getCompetitionId());
|
||||
WxMssVo wxMssVo = new WxMssVo();
|
||||
wxMssVo.setTemplate_id(WxAppletsTemplateIdsEnum.COMPETITION_COURSE_REMIND.getCode());
|
||||
wxMssVo.setTouser(vo.getGuestTeamOpenId());
|
||||
Map<String, TemplateDataVo> map = new HashMap<>();
|
||||
map.put("thing1", new TemplateDataVo(vo.getMainTeamName()+" VS "+vo.getGuestTeamName()));
|
||||
map.put("thing2", new TemplateDataVo(vo.getCompetitionDate() +" " +vo.getTheTime()));
|
||||
map.put("thing3", new TemplateDataVo(vo.getVsType()));
|
||||
map.put("thing4", new TemplateDataVo("你的球队今天有比赛哦,快去为自己的球队冲榜"));
|
||||
wxMssVo.setData(map);
|
||||
wxAppletsService.pushOneUser(wxMssVo);
|
||||
}
|
||||
}
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
@ -66,4 +66,6 @@ public interface CompetitionMapper
|
|||
CompetitionExcleVo getTeamEnrollExcleImpData(Long competitionId, Long userId);
|
||||
|
||||
List<Competition> getMyJoinCompetition(CompetitionVo competition);
|
||||
|
||||
int updateCompetitionFinish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import com.ruoyi.system.domain.CompetitionTeamVsTeam;
|
||||
import com.ruoyi.system.domain.vo.CompetitionTeamIntegralVo;
|
||||
import com.ruoyi.system.domain.vo.CompetitionTeamVsTeamVo;
|
||||
import com.ruoyi.system.service.ICompetitionResultService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
|
@ -76,4 +77,8 @@ public interface CompetitionTeamVsTeamMapper
|
|||
List<CompetitionTeamVsTeamVo> getLatelySchedule(CompetitionTeamVsTeam competitionTeamVsTeam);
|
||||
|
||||
List<CompetitionTeamIntegralVo> getCompetitionTeamIntegralListById(@Param("id") Long id);
|
||||
|
||||
int competitionVsTeamStatusUpdate(CompetitionTeamVsTeam competitionTeamVsTeam);
|
||||
|
||||
List<CompetitionTeamVsTeamVo> getTodaySchedule(ICompetitionResultService competitionResultService);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,4 +87,6 @@ public interface ICompetitionService
|
|||
Boolean edit(Competition entity);
|
||||
|
||||
CompetitionExcleVo importExcleData(Long competitionId,Map<String, PictureData> maplist, Sheet sheet);
|
||||
//根据当前时间修改已经完成的赛会数据
|
||||
int updateCompetitionFinish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,4 +76,8 @@ public interface ICompetitionTeamVsTeamService
|
|||
Boolean competitionScoreSubmit(List<CompetitionResult> request);
|
||||
|
||||
Boolean deleteBatchByIds(Ids ids);
|
||||
|
||||
int competitionVsTeamStatusUpdate(CompetitionTeamVsTeam competitionTeamVsTeam);
|
||||
|
||||
List<CompetitionTeamVsTeamVo> getTodaySchedule(CompetitionTeamVsTeam competitionTeamVsTeam);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -688,4 +688,9 @@ public class CompetitionServiceImpl implements ICompetitionService
|
|||
}
|
||||
return excleVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCompetitionFinish() {
|
||||
return competitionMapper.updateCompetitionFinish();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,4 +299,14 @@ public class CompetitionTeamVsTeamServiceImpl implements ICompetitionTeamVsTeamS
|
|||
competitionTeamVsTeamMapper.deleteCompetitionTeamVsTeamByIds(idList);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int competitionVsTeamStatusUpdate(CompetitionTeamVsTeam competitionTeamVsTeam) {
|
||||
return competitionTeamVsTeamMapper.competitionVsTeamStatusUpdate(competitionTeamVsTeam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompetitionTeamVsTeamVo> getTodaySchedule(CompetitionTeamVsTeam competitionTeamVsTeam) {
|
||||
return competitionTeamVsTeamMapper.getTodaySchedule(competitionResultService);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,6 +344,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateCompetitionFinish">
|
||||
update competition set status = 2 where status <> 2 and competition_end_time <![CDATA[ <= ]]> now()
|
||||
</update>
|
||||
|
||||
<delete id="deleteCompetitionById" parameterType="Long">
|
||||
delete from competition where id = #{id}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,100 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY t.competition_of_team_id
|
||||
ORDER BY sum(t.integral) desc
|
||||
</select>
|
||||
<select id="getTodaySchedule" resultType="com.ruoyi.system.domain.vo.CompetitionTeamVsTeamVo">
|
||||
select
|
||||
t.id as id,
|
||||
t.competition_id as competitionId,
|
||||
t.main_team_id as mainTeamId,
|
||||
b1.TEAM_NAME as mainTeamName,
|
||||
b1.team_logo as mainTeamLogo,
|
||||
t.guest_team_id as guestTeamId,
|
||||
b2.TEAM_NAME as guestTeamName,
|
||||
b2.team_logo as guestTeamLogo,
|
||||
t.competition_time as competitionTime,
|
||||
t.building_id as buildingId,
|
||||
t.building_name as buildingName,
|
||||
t.competition_address as competitionAddress,
|
||||
t.competition_group as competitionGroup,
|
||||
t.status,
|
||||
t.vs_type as vsType,
|
||||
t.created_time as createdTime,
|
||||
t.last_updated_time as lastUpdatedTime,
|
||||
t.created_by as createdBy,
|
||||
t.modified_by as modifiedBy,
|
||||
t.main_team_score as mainTeamScore,
|
||||
t.guest_team_score as guestTeamScore,
|
||||
t.is_deleted as isDeleted,
|
||||
DATE_FORMAT(t.competition_time,'%Y年%m月%d日') as competitionDate,
|
||||
CASE dayofweek(t.competition_time)
|
||||
WHEN 1 THEN
|
||||
'星期日'
|
||||
WHEN 2 THEN
|
||||
'星期一'
|
||||
WHEN 3 THEN
|
||||
'星期二'
|
||||
WHEN 4 THEN
|
||||
'星期三'
|
||||
WHEN 5 THEN
|
||||
'星期四'
|
||||
WHEN 6 THEN
|
||||
'星期五'
|
||||
WHEN 7 THEN
|
||||
'星期六'
|
||||
END as weekDayName,
|
||||
CASE t.status
|
||||
WHEN -1 THEN
|
||||
'已取消'
|
||||
WHEN 0 THEN
|
||||
'报名中'
|
||||
WHEN 1 THEN
|
||||
'比赛中'
|
||||
WHEN 2 THEN
|
||||
'已结束'
|
||||
END as statusName,
|
||||
DATE_FORMAT(t.competition_time,'%H:%i') AS theTime,
|
||||
t.remark as remark,
|
||||
u1.OPENID as guestTeamOpenId,
|
||||
u2.OPENID as mainTeamOpenId
|
||||
from competition_team_vs_team t
|
||||
LEFT JOIN competition_of_team b1 ON b1.id = t.main_team_id
|
||||
left join user_info u1 on u1.id=b1.created_by
|
||||
left join competition_of_team b2 on t.guest_team_id=b2.id
|
||||
left join user_info u2 on u2.id=b2.created_by
|
||||
where 1=1
|
||||
<![CDATA[ and to_days(competition_time) <= to_days(now()) ]]>
|
||||
<if test="comp.id != null ">
|
||||
AND t.id=#{comp.id}
|
||||
</if>
|
||||
<if test="comp.status != null ">
|
||||
AND t.status =#{comp.status}
|
||||
</if>
|
||||
<if test="comp.isDeleted != null ">
|
||||
AND t.is_deleted =#{comp.isDeleted}
|
||||
</if>
|
||||
<if test="comp.competitionId != null ">
|
||||
AND t.competition_id=#{comp.competitionId}
|
||||
</if>
|
||||
<if test="comp.buildingName != null and comp.buildingName != ''">
|
||||
AND t.building_name like CONCAT('%',#{comp.buildingName},'%')
|
||||
</if>
|
||||
<if test="comp.competitionGroup != null ">
|
||||
AND t.competition_group = #{comp.competitionGroup}
|
||||
</if>
|
||||
<if test="comp.mainTeamName != null and comp.mainTeamName != ''">
|
||||
AND t.main_team_name like CONCAT('%',#{comp.mainTeamName},'%')
|
||||
</if>
|
||||
<if test="comp.guestTeamName != null and comp.guestTeamName != ''">
|
||||
AND t.guest_team_name like CONCAT('%',#{comp.guestTeamName},'%')
|
||||
</if>
|
||||
<if test="comp.competitionAddress != null and comp.competitionAddress != '' ">
|
||||
AND t.competition_address like CONCAT('%',#{comp.competitionAddress},'%')
|
||||
</if>
|
||||
<if test="comp.buildingName != null and comp.buildingName != '' ">
|
||||
AND t.building_name like CONCAT('%',#{comp.buildingName},'%')
|
||||
</if>
|
||||
order by t.competition_time asc
|
||||
</select>
|
||||
|
||||
<insert id="insertCompetitionTeamVsTeam" parameterType="CompetitionTeamVsTeam" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into competition_team_vs_team
|
||||
|
|
@ -348,6 +442,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="batchNumber != null and batchNumber != ''"> and batch_number = #{batchNumber}</if>
|
||||
</where>
|
||||
</update>
|
||||
<update id="competitionVsTeamStatusUpdate">
|
||||
update competition_team_vs_team set status = 2 where status <> 2 and competition_time <![CDATA[ <= ]]> now()
|
||||
</update>
|
||||
|
||||
<delete id="deleteCompetitionTeamVsTeamById" parameterType="Long">
|
||||
delete from competition_team_vs_team where id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue