9.23更新
This commit is contained in:
parent
4d773c7cb1
commit
ed99549b99
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.cms.controller;
|
package com.ruoyi.cms.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
|
import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
|
||||||
import com.ruoyi.cms.service.IHitCompetitionStudentInfoService;
|
import com.ruoyi.cms.service.IHitCompetitionStudentInfoService;
|
||||||
@ -176,15 +177,15 @@ public class HitCompetitionStudentInfoController extends BaseController {
|
|||||||
@PostMapping("/importTemplate")
|
@PostMapping("/importTemplate")
|
||||||
public void importTemplate(HttpServletResponse response)
|
public void importTemplate(HttpServletResponse response)
|
||||||
{
|
{
|
||||||
ExcelUtil<HitCompetitionStudentInfo> util = new ExcelUtil<HitCompetitionStudentInfo>(HitCompetitionStudentInfo.class);
|
ExcelUtil<HitCompetitionStudentInfoImportVo> util = new ExcelUtil<>(HitCompetitionStudentInfoImportVo.class);
|
||||||
util.importTemplateExcel(response, "用户数据");
|
util.importTemplateExcel(response, "用户数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(MultipartFile file) throws Exception
|
public AjaxResult importData(MultipartFile file) throws Exception
|
||||||
{
|
{
|
||||||
ExcelUtil<HitCompetitionStudentInfo> util = new ExcelUtil<HitCompetitionStudentInfo>(HitCompetitionStudentInfo.class);
|
ExcelUtil<HitCompetitionStudentInfoImportVo> util = new ExcelUtil<>(HitCompetitionStudentInfoImportVo.class);
|
||||||
List<HitCompetitionStudentInfo> hitList = util.importExcel(file.getInputStream());
|
List<HitCompetitionStudentInfoImportVo> hitList = util.importExcel(file.getInputStream());
|
||||||
String message = hitCompetitionStudentInfoService.importData(hitList);
|
String message = hitCompetitionStudentInfoService.importData(hitList);
|
||||||
return success(message);
|
return success(message);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import static com.ruoyi.common.annotation.Excel.Type.EXPORT;
|
import static com.ruoyi.common.annotation.Excel.Type.EXPORT;
|
||||||
|
import static com.ruoyi.common.annotation.Excel.Type.IMPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -90,7 +91,7 @@ public class HitCompetitionStudentInfo implements Serializable {
|
|||||||
@ApiModelProperty(value = "学生证")
|
@ApiModelProperty(value = "学生证")
|
||||||
private String studentIdCard;
|
private String studentIdCard;
|
||||||
|
|
||||||
// @Excel(name = "个人选拔赛分数")
|
@Excel(name = "个人选拔赛分数",type = IMPORT)
|
||||||
@ApiModelProperty(value = "个人选拔赛分数")
|
@ApiModelProperty(value = "个人选拔赛分数")
|
||||||
private BigDecimal trialsScore;
|
private BigDecimal trialsScore;
|
||||||
|
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
package com.ruoyi.cms.domain.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.ruoyi.cms.domain.HitRegInfo;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.annotation.Excel.Type.EXPORT;
|
||||||
|
import static com.ruoyi.common.annotation.Excel.Type.IMPORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 大赛学生表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author author
|
||||||
|
* @since 2024-08-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("hit_competition_student_info")
|
||||||
|
@ApiModel(value="HitCompetitionStudentInfo对象", description="大赛学生表")
|
||||||
|
public class HitCompetitionStudentInfoImportVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "团队报名主键")
|
||||||
|
private String hitRegId;
|
||||||
|
|
||||||
|
// @Excel(name = "学生姓名",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "学生姓名")
|
||||||
|
private String stuName;
|
||||||
|
|
||||||
|
//用户主键
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学号")
|
||||||
|
private String studentId;
|
||||||
|
|
||||||
|
// @Excel(name = "学校名称",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "学校名称")
|
||||||
|
private String schoolName;
|
||||||
|
|
||||||
|
// @Excel(name = "院系名称",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "院系名称")
|
||||||
|
private String collegeName;
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "专业")
|
||||||
|
private String major;
|
||||||
|
|
||||||
|
// @Excel(name = "所属赛区",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "所属赛区")
|
||||||
|
private String division;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String competition;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String divisionLabel;
|
||||||
|
|
||||||
|
@Excel(name = "手机号")
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
// @Excel(name = "邮箱",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "学生证")
|
||||||
|
private String studentIdCard;
|
||||||
|
|
||||||
|
@Excel(name = "个人选拔赛分数")
|
||||||
|
@ApiModelProperty(value = "个人选拔赛分数")
|
||||||
|
private BigDecimal trialsScore;
|
||||||
|
|
||||||
|
// @Excel(name = "是否被选为参加地区选拔赛人员", readConverterExp = "false=待审核,true=已入选",type = EXPORT)
|
||||||
|
@ApiModelProperty(value = "是否被选为参加初赛人员 (0: 否, 1: 是)")
|
||||||
|
private Boolean isPreliminary;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "逻辑删除 0未删除 1真删除")
|
||||||
|
private Boolean delFlag;
|
||||||
|
|
||||||
|
// @Excel(name = "报名时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建时间(默认时间当前)")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间(默认时间当前)")
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String year;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private HitRegistrationTeachInfo ldTeacherInfo;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<HitRegistrationTeachInfo> zdTeacherList;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<HitCompetitionStudentInfoImportVo> tdStudentList;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String zdStatus;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private HitRegInfo hitRegInfo;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String zdTeacherStr;
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ package com.ruoyi.cms.service;
|
|||||||
import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
|
import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.cms.domain.HitTeamMembers;
|
import com.ruoyi.cms.domain.HitTeamMembers;
|
||||||
|
import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo;
|
||||||
import com.ruoyi.cms.domain.vo.TeamsVo;
|
import com.ruoyi.cms.domain.vo.TeamsVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -98,5 +99,5 @@ public interface IHitCompetitionStudentInfoService extends IService<HitCompetiti
|
|||||||
* @param hitList
|
* @param hitList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String importData(List<HitCompetitionStudentInfo> hitList);
|
String importData(List<HitCompetitionStudentInfoImportVo> hitList);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.ruoyi.cms.service.impl;
|
package com.ruoyi.cms.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.cms.domain.*;
|
import com.ruoyi.cms.domain.*;
|
||||||
|
import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo;
|
||||||
import com.ruoyi.cms.domain.vo.TeamsVo;
|
import com.ruoyi.cms.domain.vo.TeamsVo;
|
||||||
import com.ruoyi.cms.mapper.HitCompetitionStudentInfoMapper;
|
import com.ruoyi.cms.mapper.HitCompetitionStudentInfoMapper;
|
||||||
import com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper;
|
import com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper;
|
||||||
@ -157,6 +159,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
|
|||||||
{
|
{
|
||||||
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName());
|
queryWrapper.eq(HitCompetitionStudentInfo::getSchoolName, hitCompetitionStudentInfo.getSchoolName());
|
||||||
|
queryWrapper.eq(HitCompetitionStudentInfo::getIsPreliminary,true);
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
DateTime dateTime = DateUtil.beginOfYear(now);
|
DateTime dateTime = DateUtil.beginOfYear(now);
|
||||||
DateTime dateTime1 = DateUtil.endOfYear(now);
|
DateTime dateTime1 = DateUtil.endOfYear(now);
|
||||||
@ -364,7 +367,7 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String importData(List<HitCompetitionStudentInfo> hitList) {
|
public String importData(List<HitCompetitionStudentInfoImportVo> hitList) {
|
||||||
//获取当前时间
|
//获取当前时间
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
@ -377,12 +380,19 @@ public class HitCompetitionStudentInfoServiceImpl extends ServiceImpl<HitCompeti
|
|||||||
//判断手机号与分数是否为空
|
//判断手机号与分数是否为空
|
||||||
if (!StringUtils.isNull(item.getPhoneNumber()) || !StringUtils.isNull(item.getTrialsScore()))
|
if (!StringUtils.isNull(item.getPhoneNumber()) || !StringUtils.isNull(item.getTrialsScore()))
|
||||||
{
|
{
|
||||||
|
//添加trycatch 如果报错继续往下面修改
|
||||||
|
try {
|
||||||
|
HitCompetitionStudentInfo hitCompetitionStudentInfo = BeanUtil.copyProperties(item, HitCompetitionStudentInfo.class);
|
||||||
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
// queryWrapper.likeRight(HitCompetitionStudentInfo::getYear, year);
|
|
||||||
queryWrapper.eq(HitCompetitionStudentInfo::getPhoneNumber, item.getPhoneNumber());
|
queryWrapper.eq(HitCompetitionStudentInfo::getPhoneNumber, item.getPhoneNumber());
|
||||||
queryWrapper.between(HitCompetitionStudentInfo::getCreateTime, DateUtil.beginOfYear(now), DateUtil.endOfYear(now));
|
queryWrapper.between(HitCompetitionStudentInfo::getCreateTime, DateUtil.beginOfYear(now), DateUtil.endOfYear(now));
|
||||||
item.setUpdateTime(date);
|
item.setUpdateTime(date);
|
||||||
hitCompetitionStudentInfoMapper.update(item, queryWrapper);
|
hitCompetitionStudentInfo.setUpdateTime(date);
|
||||||
|
hitCompetitionStudentInfoMapper.update(hitCompetitionStudentInfo, queryWrapper);
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("更新学生信息失败,phoneNumber: " + item.getPhoneNumber(), e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user