he2802 пре 1 година
родитељ
комит
096f5b4093

+ 28 - 7
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1758,11 +1758,18 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         iSysTaskService.updateById(task);
         String zhiyuan = System.getProperty("user.dir");
         String toPath = zhiyuan + "/zhongzheng-admin/src/main/resources/dangan"+DateUtils.getNowTime();
+        List<UserDataExcelBo> userList = new ArrayList<>();
         for (Long userId : bo.getUserIds()) {
             User user = getById(userId);
             if (ObjectUtil.isNull(user)){
                 continue;
             }
+            UserDataExcelBo userBo = BeanUtil.toBean(user, UserDataExcelBo.class);
+            userBo.setRegisterTime(DateUtils.timestampToDateFormat(user.getCreateTime(),"yyyy/MM/dd HH:mm:ss"));
+            userBo.setSex(ObjectUtil.isNotNull(user.getSex()) && user.getSex() == 1?"男":"女");
+            userBo.setUserPhone(EncryptHandler.decrypt(user.getTelphone()));
+            userBo.setUserCard(EncryptHandler.decrypt(user.getIdCard()));
+            userList.add(userBo);
             String userPath = toPath + "/" +user.getRealname()+EncryptHandler.decrypt(user.getIdCard());
             File file = new File(userPath);
             if (!file.exists()) {
@@ -1989,6 +1996,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                         if (!CollectionUtils.isEmpty(recordVos)){
                             List<String> paths = new ArrayList<>();
                             recordVos.forEach(item -> {
+                                item.setRealname(user.getRealname());
+                                item.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
+                                item.setUploadTimeStr(DateUtils.timestampToDateFormat(item.getUploadTime(),"yyyy-MM-dd HH:mm:ss"));
+                                item.setSignStatusStr(ObjectUtils.isNotNull(item.getSignStatus()) && item.getSignStatus() == 1 ? "已签名":"未签名");
+                                item.setStampStatusStr(ObjectUtils.isNotNull(item.getStampStatus()) && item.getStampStatus() == 1 ? "已盖章":"未盖章");
                                 item.setStampStatus(0);
                                 if (ObjectUtils.isNotNull(item.getKeyValue())){
                                     JSONObject jsonObject = JSONObject.parseObject(item.getKeyValue());
@@ -2009,12 +2021,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                                     }
                                 }
                             });
+                            ExcelUtil<UserPromiseRecordVo> util5 = new ExcelUtil<>(UserPromiseRecordVo.class);
+                            String commitmentPath = userPath + "/承诺书" ;
+                            File file2 = new File(commitmentPath);
+                            if (!file2.exists()) {
+                                file2.mkdirs();
+                            }
+                            String path5 = commitmentPath + "/"+"承诺书.xlsx";
+                            util5.exportEasyExcelUtil(recordVos, UserPromiseRecordVo.class,path5);
                             if (!CollectionUtils.isEmpty(paths)){
-                                String commitmentPath = userPath + "/承诺书" ;
-                                File file2 = new File(commitmentPath);
-                                if (!file2.exists()) {
-                                    file2.mkdirs();
-                                }
                                 for (String path : paths) {
                                     try {
                                         InputStream inputStream = ossService.getStreamByObject(path);
@@ -2039,8 +2054,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             }
         }
 
+        if (!CollectionUtils.isEmpty(userList) && userList.size() > 1){
+            ExcelUtil<UserDataExcelBo> list = new ExcelUtil<>(UserDataExcelBo.class);
+            String path = toPath + "/"+"学员列表.xlsx";
+            list.exportEasyExcelUtil(userList, UserDataExcelBo.class,path);
+        }
+
         //压缩上传oss
-        String zipPath = zhiyuan + "/zhongzheng-admin/src/main/resources/danganzip" + "/" + DateUtils.getNowTime() + ".zip";
+        String zipPath = zhiyuan + "/zhongzheng-admin/src/main/resources/danganzip" + "/" + "档案下载"+DateUtils.getNowTime() + ".zip";
         File desc = new File(zipPath);
         if (!desc.getParentFile().exists()) {
             desc.getParentFile().mkdirs();
@@ -2056,7 +2077,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 OssRequest ossRequest = new OssRequest();
                 ossRequest.setGradeId(0L);
                 ossRequest.setUserId(0L);
-                ossRequest.setImageStatus(7);
+                ossRequest.setImageStatus(12);
                 File file1 = new File(zipPath);
                 ossRequest.setFile(FileUtils.getMultipartFile(file1));
                 String upload = ossService.upload(ossRequest);

+ 19 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserPromiseRecordVo.java

@@ -1,11 +1,10 @@
 package com.zhongzheng.modules.user.vo;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.math.BigDecimal;
-
 /**
  * 【请填写功能名称】视图对象 mall_package
  *
@@ -20,10 +19,20 @@ public class UserPromiseRecordVo {
 
     private Long id;
 
+    @Excel(name = "姓名")
+    private String realname;
+
+    @Excel(name = "身份证号")
+    private String idCard;
+
     @ApiModelProperty("上传时间")
     private Long uploadTime;
 
+    @Excel(name = "上传时间")
+    private String uploadTimeStr;
+
     @ApiModelProperty("课程名称")
+    @Excel(name = "课程")
     private String goodsName;
 
     private Long educationTypeId;
@@ -37,17 +46,25 @@ public class UserPromiseRecordVo {
     private String keyValue;
 
     @ApiModelProperty("业务类型")
+    @Excel(name = "业务类型")
     private String businessName;
 
     @ApiModelProperty("专业名称")
+    @Excel(name = "专业")
     private String majorName;
 
     @ApiModelProperty("签名状态:1已签名")
     private Integer signStatus;
 
+    @Excel(name = "签名状态")
+    private String signStatusStr;
+
     @ApiModelProperty("盖章状态:1已盖章 0待盖章")
     private Integer stampStatus;
 
+    @Excel(name = "盖章状态")
+    private String stampStatusStr;
+
     @ApiModelProperty("承诺书地址")
     private String promiseUrl;