浏览代码

fix 证书

he2802 3 年之前
父节点
当前提交
37beb455b2

二进制
zhongzheng-common/src/main/resources/static/002.jpg


二进制
zhongzheng-common/src/main/resources/static/003.jpg


+ 19 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -36,6 +36,7 @@ import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserVo;
+import org.apache.commons.compress.utils.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -427,8 +428,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         String imgName = projectUrl + "out01.jpg";
         try {
             // 加载本地图片
-            String imageLocalUrl = projectUrl + "002.jpg";
-            BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/002.jpg");
+    //        String imageLocalUrl = projectUrl + "002.jpg";
+   //         BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            BufferedImage imageLocal = ImageIO.read(imgStream);
             // 以本地图片为模板
             Graphics2D g = imageLocal.createGraphics();
 
@@ -478,7 +481,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     //        ImageIO.write(imageLocal, "jpg", outputfile);
             //上传OSS
             InputStream is =  bufferedImageToInputStream(imageLocal);
-            return ossService.uploadInputStream(is,7);
+            String ossPath = ossService.uploadInputStream(is,7);
+            if(imgStream!=null){
+                imgStream.close();
+            }
+            return ossPath;
 
         } catch (Exception e) {
             e.printStackTrace();
@@ -493,8 +500,10 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         String imgName = projectUrl + "out02.jpg";
         try {
             // 加载本地图片
-            String imageLocalUrl = projectUrl + "003.jpg";
-            BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/003.jpg");
+            //        String imageLocalUrl = projectUrl + "003.jpg";
+            //         BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            BufferedImage imageLocal = ImageIO.read(imgStream);
             // 以本地图片为模板
             Graphics2D g = imageLocal.createGraphics();
 
@@ -535,7 +544,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     //        ImageIO.write(imageLocal, "jpg", outputfile);
             //上传OSS
             InputStream is =  bufferedImageToInputStream(imageLocal);
-            return ossService.uploadInputStream(is,7);
+            String ossPath = ossService.uploadInputStream(is,7);
+            if(imgStream!=null){
+                imgStream.close();
+            }
+            return ossPath;
         } catch (Exception e) {
             e.printStackTrace();
         }

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

@@ -698,7 +698,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
             }
 
             //更新班级学时状态
-            /*if(!gradePeriodStatus.equals(classPeriodStudentVo.getPeriodStatus())){
+            if(!gradePeriodStatus.equals(classPeriodStudentVo.getPeriodStatus())){
                 LambdaQueryWrapper<ClassGradeUser> classGradeUser = Wrappers.lambdaQuery();
                 classGradeUser.eq(ClassGradeUser::getUserId, classPeriodStudentVo.getUserId());
                 classGradeUser.eq(ClassGradeUser::getGradeId, classPeriodStudentVo.getGradeId());
@@ -709,7 +709,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                 }
                 classGradeUser1.setUpdateTime(DateUtils.getNowTime());
                 iClassGradeUserService.update(classGradeUser1, classGradeUser);
-            }*/
+            }
            /* if (classPeriodStudentVo.getStuAllNum().equals(classPeriodStudentVo.getSecAllNum()) && classPeriodStudentVo.getExamNum().equals(classPeriodStudentVo.getRecordNum())){
                 if (classPeriodUserVos.getPending() != 0 || classPeriodUserVos.getExamPending() != 0){
                     classPeriodStudentVo.setAllStatus(0);

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -253,7 +253,6 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public boolean editPeriodAll(UserPeriodEditBo bo) {
         //查询所有审核记录
         LambdaQueryWrapper<UserPeriod> lqw = Wrappers.lambdaQuery();

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/user/UserCertificateMapper.xml

@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="majorId" column="major_id"/>
         <result property="year" column="year"/>
         <result property="pushDate" column="push_date"/>
-        <result property="chapterStr" column="chapterStr"/>
+        <result property="chapterStr" column="chapter_str"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.UserCertificateVo" id="UserCertificateVoResult">
@@ -45,7 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="majorId" column="major_id"/>
         <result property="year" column="year"/>
         <result property="pushDate" column="push_date"/>
-        <result property="chapterStr" column="chapterStr"/>
 
         <result property="educationName" column="education_name"/>
         <result property="projectName" column="project_name"/>
@@ -55,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="title" column="title"/>
         <result property="certificateName" column="certificate_name"/>
         <result property="keyValue" column="key_value"/>
+        <result property="chapterStr" column="chapter_str"/>
     </resultMap>
 
     <select id="selectMaxId"   resultType="Long">