This commit is contained in:
mrzhou 2024-08-21 18:47:25 +08:00
parent 3d71f4af0c
commit 25aa298311
5 changed files with 222 additions and 20 deletions

View File

@ -74,4 +74,6 @@ public interface CmsContentMapper extends BaseMapper<CmsContent>
/** 修改计数 */
public int updateCount(Long id);
CmsContent selectCmsContentByContentTitle(String contentTitle);
}

View File

@ -1,18 +1,19 @@
package com.ruoyi.cms.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.cms.domain.HitRegistrationStudentInfo;
import com.ruoyi.cms.domain.HitRegistrationTeachInfo;
import com.ruoyi.cms.mapper.HitRegistrationStudentInfoMapper;
import com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper;
import com.ruoyi.cms.controller.CmsContentController;
import com.ruoyi.cms.domain.*;
import com.ruoyi.cms.mapper.*;
import com.ruoyi.cms.service.ICmsContentService;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.HitRegInfoMapper;
import com.ruoyi.cms.domain.HitRegInfo;
import com.ruoyi.cms.service.IHitRegInfoService;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +32,12 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService
private HitRegistrationStudentInfoMapper studentInfoMapper;
@Autowired
private HitRegistrationTeachInfoMapper teachInfoMapper;
@Autowired
private ICmsContentService insertCmsContent;
@Autowired
private CmsContentMapper cmsContentMapper;
/**
* 查询报名信息
@ -96,7 +103,7 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService
}
/**
* 修改报名信息
* 修改报名信息及创建/删除大赛通知信息
*
* @param hitRegInfo 报名信息
* @return 结果
@ -105,6 +112,93 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService
public int updateHitRegInfo(HitRegInfo hitRegInfo)
{
hitRegInfo.setUpdateTime(DateUtils.getNowDate());
//获取当前年份
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy");
String currentYear = LocalDate.now().format(formatter);
//拼接标题
String contentTitle = currentYear + "年全国大学生市政环境类创新实践大赛报名情况一览表";
//修改报名信息
hitRegInfoMapper.updateHitRegInfo(hitRegInfo);
//查询数据库是否存在当前年份赛事
CmsContent contentDB = cmsContentMapper.selectCmsContentByContentTitle(contentTitle);
//查询赛事通过列表
LambdaQueryWrapper<HitRegInfo> queryWrapper =new LambdaQueryWrapper();
queryWrapper.eq(HitRegInfo::getAuditStatus,"1").likeRight(BaseEntity::getCreateTime,currentYear)
.orderByAsc(HitRegInfo::getDivision).orderByAsc(BaseEntity::getCreateTime);
List<HitRegInfo> hitRegInfos = hitRegInfoMapper.selectList(queryWrapper);
if ( contentDB == null) {
CmsContent content = new CmsContent();
content.setCategoryId(1819701569722126336L);
content.setContentType("0");
content.setSummary(contentTitle);
content.setStatus("1");
content.setLinkType("2");
content.setSortNum(1);
content.setContentTitle(contentTitle);
content.setContentImg("/profile/upload/tongzhi.jpg");
content.setPublishDate(DateUtils.getNowDate());
insertCmsContent.insertCmsContent(content);
}
CmsContent content = cmsContentMapper.selectCmsContentByContentTitle(contentTitle);
//内容头部
String contentHeader = "<p style=\"box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; padding: 0px; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 24px\"><span style=\"box-sizing: border-box;font-weight: bolder\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "+contentTitle+"</span></span>\n" +
"</p>\n" +
"<table width=\"1232\" style=\"width: 1185px; margin: 0px auto;\">\n" +
" <tbody style=\"box-sizing: border-box\">\n" +
" <tr style=\"box-sizing: border-box;height: 24px\" class=\"firstRow\">\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">所属赛区</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">学校名称</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">院系名称</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">团队名称</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" </tr>";
//内容尾部
String contentFooter = " </tbody>\n" +
"</table>" ;
//内容主体
String contentDetail = "";
for (HitRegInfo regInfo : hitRegInfos) {
contentDetail = contentDetail + "<tr style=\"box-sizing: border-box;height: 24px\" class=\"firstRow\">\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">"+regInfo.getDivision()+"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">"+regInfo.getSchoolName()+"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">"+regInfo.getCollegeName()+"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" <td width=\"100\" style=\"box-sizing: border-box;border-style: solid;border-color: rgb(0, 112, 192);padding: 0px 7px\">\n" +
" <p style=\"box-sizing: border-box; text-align: center;\">\n" +
" <span style=\"box-sizing: border-box;font-size: 13px;font-family: 宋体\">"+regInfo.getTeamName()+"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\n" +
" </p>\n" +
" </td>\n" +
" </tr>";
}
content.setContentDetail(contentHeader + contentDetail + contentFooter);
insertCmsContent.updateCmsContent(content);
return hitRegInfoMapper.updateHitRegInfo(hitRegInfo);
}

View File

@ -246,6 +246,10 @@
</where>
order by sort_num ASC, create_time desc, update_time desc
</select>
<select id="selectCmsContentByContentTitle" resultType="com.ruoyi.cms.domain.CmsContent"
parameterType="java.lang.String">
select * from cms_content where content_title = #{contentTitle}
</select>
<insert id="insertCmsContent" parameterType="CmsContent">
insert into cms_content

View File

@ -15,6 +15,7 @@
<result property="sourceUrl" column="source_url"/>
<result property="original" column="original"/>
<result property="author" column="author"/>
<result property="sortNum" column="sort_num"/>
<result property="editor" column="editor"/>
<result property="summary" column="summary"/>
<result property="tagName" column="tag_name"/>
@ -52,6 +53,7 @@
source_url,
original,
author,
sort_num,
editor,
summary,
tag_name,
@ -73,7 +75,37 @@
</sql>
<select id="selectCmsContentList" parameterType="CmsContent" resultMap="CmsContentResult">
<include refid="selectCmsContentVo"/>
select id,
category_id,
content_type,
image_url,
video_url,
content_title,
content_img,
content_detail,
source,
source_url,
original,
author,
sort_num,
editor,
summary,
tag_name,
status,
publish_date,
offline_date,
is_accessory,
accessory_url,
remark,
del_flag,
create_time,
create_by,
update_time,
update_by,
link_type,
link,
count
from cms_content
<where>
<if test="categoryId != null ">and category_id = #{categoryId}</if>
<if test="contentType != null ">and content_type = #{contentType}</if>
@ -95,7 +127,62 @@
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
</where>
order by create_time desc, update_time desc
order by sort_num ASC, create_time desc, update_time desc
</select>
<select id="contentList" parameterType="CmsContent" resultMap="CmsContentResult">
select id,
category_id,
content_type,
image_url,
video_url,
content_title,
content_img,
source,
source_url,
original,
author,
sort_num,
editor,
summary,
tag_name,
status,
publish_date,
offline_date,
is_accessory,
accessory_url,
remark,
del_flag,
create_time,
create_by,
update_time,
update_by,
link_type,
link,
count
from cms_content
<where>
<if test="categoryId != null ">and category_id = #{categoryId}</if>
<if test="contentType != null ">and content_type = #{contentType}</if>
<if test="contentTitle != null and contentTitle != ''">and content_title like concat('%', #{contentTitle},
'%')
</if>
<if test="contentImg != null and contentImg != ''">and content_img = #{contentImg}</if>
<if test="contentDetail != null and contentDetail != ''">and content_detail = #{contentDetail}</if>
<if test="source != null and source != ''">and source = #{source}</if>
<if test="sourceUrl != null and sourceUrl != ''">and source_url = #{sourceUrl}</if>
<if test="original != null ">and original = #{original}</if>
<if test="author != null and author != ''">and author = #{author}</if>
<if test="editor != null and editor != ''">and editor = #{editor}</if>
<if test="summary != null and summary != ''">and summary = #{summary}</if>
<if test="status != null ">and status = #{status}</if>
<if test="publishDate != null ">and publish_date = #{publishDate}</if>
<if test="offlineDate != null ">and offline_date = #{offlineDate}</if>
<if test="isAccessory != null ">and is_accessory = #{isAccessory}</if>
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
</where>
order by sort_num ASC, create_time desc, update_time desc
</select>
<select id="selectCmsContentById" parameterType="Long" resultMap="CmsContentResult">
@ -116,6 +203,7 @@
tag_name,
original,
author,
sort_num,
editor,
summary,
status,
@ -156,7 +244,11 @@
<if test="accessoryUrl != null and accessoryUrl != ''">and accessory_url = #{accessoryUrl}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
</where>
order by create_time desc, update_time desc
order by sort_num ASC, create_time desc, update_time desc
</select>
<select id="selectCmsContentByContentTitle" resultType="com.ruoyi.cms.domain.CmsContent"
parameterType="java.lang.String">
select * from cms_content where content_title = #{contentTitle}
</select>
<insert id="insertCmsContent" parameterType="CmsContent">
@ -172,6 +264,7 @@
<if test="sourceUrl != null and sourceUrl != ''">source_url,</if>
<if test="original != null and original != ''">original,</if>
<if test="author != null and author != ''">author,</if>
<if test="sortNum != null and sortNum != ''">sort_num,</if>
<if test="editor != null and editor != ''">editor,</if>
<if test="tagName != null and tagName != ''">tag_name,</if>
<if test="summary != null and summary != ''">summary,</if>
@ -202,6 +295,7 @@
<if test="sourceUrl != null and sourceUrl != ''">#{sourceUrl},</if>
<if test="original != null and original != ''">#{original},</if>
<if test="author != null and author != ''">#{author},</if>
<if test="sortNum != null and sortNum != ''">#{sortNum},</if>
<if test="editor != null and editor != ''">#{editor},</if>
<if test="tagName != null and tagName != ''">#{tagName},</if>
<if test="summary != null and summary != ''">#{summary},</if>
@ -243,6 +337,7 @@
author = #{author},
tag_name = #{tagName},
editor = #{editor},
sort_num = #{sortNum},
summary = #{summary},
status = #{status},
publish_date = #{publishDate},

View File

@ -33,16 +33,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="大赛年份" prop="competitionYear">-->
<!-- <el-select v-model="queryParams.createTime" placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in yearList"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="大赛年份" prop="competitionYear">
<el-select v-model="queryParams.createTime" placeholder="请选择">
<el-option
<el-option
v-for="item in yearList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置刷新</el-button>
@ -115,6 +116,11 @@
</template>
</el-table-column>
<!-- <el-table-column label="比赛名称" align="center" prop="competitionName" />-->
<el-table-column label="大赛年份" align="center" prop="year" >
<template slot-scope="props">
{{props.row.createTime.substring(0,4)}}
</template>
</el-table-column>
<el-table-column label="所属赛区" align="center" prop="division" />
<el-table-column label="学校名称" align="center" prop="schoolName" />
<el-table-column label="院系名称" align="center" prop="collegeName" />
@ -232,6 +238,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
year: null,
competitionName: null,
stuName: null,
stuGender: null,