yangdamao 3 лет назад
Родитель
Сommit
f9f0732033

+ 4 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -5,6 +5,7 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
 import cn.afterturn.easypoi.excel.entity.ExportParams;
@@ -152,8 +153,9 @@ public class ClassGradeController extends BaseController {
     @GetMapping("/exportListGrade")
     public AjaxResult exportListGrade(ClassGradeUserQueryBo bo) {
         List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
-        ExcelUtil<ClassGradeStudentVo> util = new ExcelUtil<ClassGradeStudentVo>(ClassGradeStudentVo.class);
-        return util.exportExcel(list, "班级学员列表");
+        List<ClassStudentExportVo> exportVos = list.stream().map(item -> ClassStudentExportVo.initEntity(item)).collect(Collectors.toList());
+        ExcelUtil<ClassStudentExportVo> util = new ExcelUtil<ClassStudentExportVo>(ClassStudentExportVo.class);
+        return util.exportExcel(exportVos, "班级学员列表");
     }
 
     /**

+ 160 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassStudentExportVo.java

@@ -0,0 +1,160 @@
+package com.zhongzheng.modules.grade.vo;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.user.vo.UserUpdateVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+
+import javax.xml.validation.Validator;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * 班级学员导出对象 mall_package
+ *
+ * @author yangdamao
+ * @date 2021-11-10
+ */
+@Data
+@ApiModel("班级学员导出对象")
+public class ClassStudentExportVo implements Serializable {
+
+	@Excel(name = "学员编码")
+	@ApiModelProperty("学员编码")
+	private String studentCode;
+
+	@Excel(name = "学员姓名")
+	@ApiModelProperty("学员姓名")
+	private String realname;
+
+	@Excel(name = "学员身份证")
+	@ApiModelProperty("学员身份证")
+	private String idCard;
+
+	@Excel(name = "绑定手机号码")
+	@ApiModelProperty("绑定手机号码")
+	private String telPhone;
+
+	@ApiModelProperty("资料是否变更过 1变更 0未变更")
+	private Integer userStatus;
+
+	@Excel(name = "资料是否变更过")
+	private String userStatusStr;
+
+	@ApiModelProperty("用户是否绑定微信")
+	private Integer userBindWx;
+
+	@Excel(name = "是否绑定小程序账号")
+	private String userBindWxStr;
+
+	@ApiModelProperty("用户是否关注微信")
+	private Integer userFollowWx;
+
+	@Excel(name = "是否关注公众号")
+	private String userFollowWxStr;
+
+	@Excel(name = "课程学时")
+	@ApiModelProperty("课程学时")
+	private BigDecimal classHours;
+
+	@Excel(name = "用户学习时长(秒)")
+	@ApiModelProperty("用户学习时长(秒)")
+	private Integer userStudyDuration;
+
+	@ApiModelProperty("已学节数")
+	private Long stuAllNum;
+
+	@ApiModelProperty("总节数")
+	private Long secAllNum;
+
+	@Excel(name = "视频学习进度(节)")
+	@ApiModelProperty("视频学习进度(节)")
+	private String stuAllNumStr;
+
+	@ApiModelProperty("试卷数")
+	private Long examNum;
+
+	@ApiModelProperty("已做试卷")
+	private Long recordNum;
+
+	@Excel(name = "做题进度(章卷)")
+	private String recordNumStr;
+
+	@ApiModelProperty("学时审批状态 0 未通过 1通过 2待审核")
+	private Long periodStatus;
+
+	@Excel(name = "学时审批状态")
+	private String periodStatusStr;
+
+	@ApiModelProperty("服务有效期开始")
+	private Long serviceStartTime;
+
+	@ApiModelProperty("服务有效期结束")
+	private Long serviceEndTime;
+
+	@Excel(name = "学习服务期")
+	private String serviceDateStr;
+
+	@ApiModelProperty("班级有效期开始")
+	private Long classStartTime;
+
+	@ApiModelProperty("班级有效期结束")
+	private Long classEndTime;
+
+	@Excel(name = "班级有效期")
+	private String classDateStr;
+
+	@ApiModelProperty("学习完成状态 0 未学完 1学完")
+	private Long finishStatus;
+
+	@Excel(name = "学完状态")
+	private String finishStatusStr;
+
+	@ApiModelProperty("剩余学习次数")
+	@Excel(name = "剩余学习机会(次)")
+	private Long studyCount;
+
+	@ApiModelProperty("0 非复购 1复购 针对业务层次配了【下单前需要  选择班级")
+	private Integer rebuy;
+
+	@Excel(name = "复购-学时冲突")
+	private String rebuyStr;
+
+	public static ClassStudentExportVo initEntity(ClassGradeStudentVo studentVo){
+		ClassStudentExportVo vo = new ClassStudentExportVo();
+		BeanUtils.copyProperties(studentVo,vo);
+		vo.setUserStatusStr(ObjectUtil.isNotNull(studentVo.getUserStatus()) && studentVo.getUserStatus() == 1?"变更":"未变更");
+		vo.setUserBindWxStr(ObjectUtil.isNotNull(studentVo.getUserBindWx()) && studentVo.getUserBindWx() == 1?"是":"否");
+		vo.setUserFollowWxStr(ObjectUtil.isNotNull(studentVo.getUserFollowWx()) && studentVo.getUserFollowWx() == 1?"是":"否");
+		if (ObjectUtil.isNotNull(studentVo.getStuAllNum()) && ObjectUtil.isNotNull(studentVo.getSecAllNum())){
+			BigDecimal bigDecimal = new BigDecimal(studentVo.getStuAllNum());
+			BigDecimal bigDecimal1 = new BigDecimal(studentVo.getSecAllNum());
+			BigDecimal multiply = bigDecimal.divide(bigDecimal1, 0, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100.00"));
+			vo.setStuAllNumStr(studentVo.getStuAllNum()+"/"+studentVo.getSecAllNum()+" "+multiply+"%");
+		}
+		if (ObjectUtil.isNotNull(studentVo.getRecordNum()) && ObjectUtil.isNotNull(studentVo.getExamNum())){
+			BigDecimal bigDecimal = new BigDecimal(studentVo.getRecordNum());
+			BigDecimal bigDecimal1 = new BigDecimal(studentVo.getExamNum());
+			BigDecimal multiply = bigDecimal.divide(bigDecimal1, 0, BigDecimal.ROUND_CEILING).multiply(new BigDecimal("100.00"));
+			vo.setRecordNumStr(studentVo.getRecordNum()+"/"+studentVo.getExamNum()+" "+multiply+"%");
+		}
+		vo.setPeriodStatusStr(studentVo.getPeriodStatus() == 0 ? "未通过":studentVo.getPeriodStatus() == 1?"通过":"待审核");
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		if (ObjectUtil.isNotNull(studentVo.getServiceStartTime()) && ObjectUtil.isNotNull(studentVo.getServiceEndTime())){
+			vo.setServiceDateStr(sdf.format(new Date(studentVo.getServiceStartTime()))+"至"+sdf.format(new Date(studentVo.getServiceEndTime())));
+		}
+		if (ObjectUtil.isNotNull(studentVo.getClassStartTime()) && ObjectUtil.isNotNull(studentVo.getClassEndTime())){
+			vo.setClassDateStr(sdf.format(new Date(studentVo.getClassStartTime()))+"至"+sdf.format(new Date(studentVo.getClassEndTime())));
+		}
+		vo.setFinishStatusStr(ObjectUtil.isNotNull(studentVo.getFinishStatus()) && studentVo.getFinishStatus() == 1?"学完":"未学完");
+		vo.setRebuyStr(ObjectUtil.isNotNull(studentVo.getRebuy()) && studentVo.getRebuy() == 1?"复购 针对业务层次配了【下单前需要选择班级】":"非复购");
+		return vo;
+	}
+}

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/domain/MessageUtil.java

@@ -120,7 +120,7 @@ public class MessageUtil {
         allMessage.setFromUserName(toUserName);
         allMessage.setToUserName(fromUserName);
         allMessage.setMsgType(MessageTypeEnum.MSG_TEXT.getMsgType());
-        allMessage.setCreateTime(new Date().getTime());
+        allMessage.setCreateTime(System.currentTimeMillis());
         allMessage.setContent(content);
 
         return allMessage;