yangdamao 1 год назад
Родитель
Сommit
ce5f863a4b

+ 40 - 33
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1741,6 +1741,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void userDateDownload(UserDownloadBo bo) {
         SysTask task = iSysTaskService.getOne(new LambdaQueryWrapper<SysTask>()
                 .eq(SysTask::getSysUserId, bo.getCreateSysUserId())
@@ -1783,47 +1784,52 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                         break;
                     case 2://证件照
                         //获取个人近照
-                        try {
-                            InputStream inputStream = ossService.getStreamByObject(user.getOneInchPhotos());
-                            //写入本地文件
-                            String inchPath = userPath + "/证件照.jpg";
-                            FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
-                            byte[] buffer = new byte[1024];
-                            int len = 0;
-                            while ((len = inputStream.read(buffer)) != -1) {
-                                fileOutputStream.write(buffer, 0, len);
+                        if (ObjectUtils.isNotNull(user.getOneInchPhotos())){
+                            try {
+                                InputStream inputStream = ossService.getStreamByObject(user.getOneInchPhotos());
+                                //写入本地文件
+                                String inchPath = userPath + "/证件照.jpg";
+                                FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
+                                byte[] buffer = new byte[1024];
+                                int len = 0;
+                                while ((len = inputStream.read(buffer)) != -1) {
+                                    fileOutputStream.write(buffer, 0, len);
+                                }
+                                inputStream.close();
+                                fileOutputStream.close();
+                            } catch (Exception e) {
+                                e.printStackTrace();
                             }
-                            inputStream.close();
-                            fileOutputStream.close();
-                        } catch (Exception e) {
-                            e.printStackTrace();
                         }
                         break;
                     case 3://身份证照片
                         //获取身份证照片
                         try {
-                            InputStream inputStream = ossService.getStreamByObject(user.getIdCardImg1());
-                            //写入本地文件
-                            String inchPath = userPath + "/身份证正面.jpg";
-                            FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
-                            byte[] buffer = new byte[1024];
-                            int len = 0;
-                            while ((len = inputStream.read(buffer)) != -1) {
-                                fileOutputStream.write(buffer, 0, len);
+                            if (ObjectUtils.isNotNull(user.getIdCardImg1())){
+                                InputStream inputStream = ossService.getStreamByObject(user.getIdCardImg1());
+                                //写入本地文件
+                                String inchPath = userPath + "/身份证正面.jpg";
+                                FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
+                                byte[] buffer = new byte[1024];
+                                int len = 0;
+                                while ((len = inputStream.read(buffer)) != -1) {
+                                    fileOutputStream.write(buffer, 0, len);
+                                }
+                                inputStream.close();
+                                fileOutputStream.close();
                             }
-                            inputStream.close();
-                            fileOutputStream.close();
-
-                            InputStream inputStream2 = ossService.getStreamByObject(user.getIdCardImg2());
-                            String inchPath2 = userPath + "/身份证反面.jpg";
-                            FileOutputStream fileOutputStream2 = new FileOutputStream(inchPath2);
-                            byte[] buffer2 = new byte[1024];
-                            int len2 = 0;
-                            while ((len2 = inputStream2.read(buffer2)) != -1) {
-                                fileOutputStream2.write(buffer2, 0, len2);
+                            if (ObjectUtils.isNotNull(user.getIdCardImg2())){
+                                InputStream inputStream2 = ossService.getStreamByObject(user.getIdCardImg2());
+                                String inchPath2 = userPath + "/身份证反面.jpg";
+                                FileOutputStream fileOutputStream2 = new FileOutputStream(inchPath2);
+                                byte[] buffer2 = new byte[1024];
+                                int len2 = 0;
+                                while ((len2 = inputStream2.read(buffer2)) != -1) {
+                                    fileOutputStream2.write(buffer2, 0, len2);
+                                }
+                                inputStream2.close();
+                                fileOutputStream2.close();
                             }
-                            inputStream2.close();
-                            fileOutputStream2.close();
                         } catch (Exception e) {
                             e.printStackTrace();
                         }
@@ -1911,6 +1917,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                                 item.setRealname(user.getRealname());
                                 item.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
                                 item.setSubscribeStatusStr(item.getSubscribeStatus() == 1 ? "已预约":"已取消");
+                                item.setCreateTimeStr(DateUtils.timestampToDateFormat(item.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
                                 if (item.getSubscribeStatus() == 1){
                                     if (ObjectUtils.isNull(item.getApplyTime())){
                                         item.setSubscribeStatus(3);

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -1755,6 +1755,10 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         userPeriodExportVo.setChapterName(chapterName);
         userPeriodExportVo.setSectionName(sectionName);
         List<UserPeriodItemExportVo> studyList = new ArrayList<>();
+        if (ObjectUtils.isNull(classPeriodSectionVo.getSectionType())){
+            userPeriodExportVo.setRecordList(studyList);
+            return userPeriodExportVo;
+        }
         //录播
         if (classPeriodSectionVo.getSectionType() == 1) {
             Long startTime = null;