he2802 3 роки тому
батько
коміт
1e0a4f3d01
16 змінених файлів з 300 додано та 45 видалено
  1. 1 1
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserCertificateController.java
  2. 0 7
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java
  3. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  4. 24 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  5. 169 28
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java
  6. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/CertificatePhotoVo.java
  7. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysOperLogServiceImpl.java
  8. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateAddBo.java
  9. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateEditBo.java
  10. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateQueryBo.java
  11. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserCertificate.java
  12. 6 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserCertificateMapper.java
  13. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserCertificateService.java
  14. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserCertificateServiceImpl.java
  15. 24 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserCertificateVo.java
  16. 46 1
      zhongzheng-system/src/main/resources/mapper/modules/user/UserCertificateMapper.xml

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserCertificateController.java

@@ -50,7 +50,7 @@ public class UserCertificateController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<UserCertificateVo> list(UserCertificateQueryBo bo) {
         startPage();
-        List<UserCertificateVo> list = iUserCertificateService.queryList(bo);
+        List<UserCertificateVo> list = iUserCertificateService.selectList(bo);
         return getDataTable(list);
     }
 

+ 0 - 7
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -138,12 +138,5 @@ public class UserController extends BaseController {
         return getDataTable(list);
     }
 
-    @ApiOperation("测试")
-    @PreAuthorize("@ss.hasPermi('app:user:studyRecordList')")
-    @GetMapping("/test")
-    public AjaxResult<Void> test(UserStudyRecordQueryBo bo) {
-        iSmsService.sendPwdSms("15999946079","559195");
-        return AjaxResult.success();
-    }
 
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java

@@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.FileNotFoundException;
+import java.io.InputStream;
 import java.util.Map;
 
 public interface OssService {
@@ -17,6 +18,8 @@ public interface OssService {
 
     String upload(OssRequest base) throws Exception;
 
+    String uploadInputStream(InputStream inputStream,Integer imageStatus) throws Exception;
+
     String uploadBase64(String fileStr);
 
     void closeClient();

+ 24 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -136,6 +136,9 @@ public class OssServiceImpl implements OssService {
             case 6 :
                 RandomFilename = "file"+"/"+sdf.format(new Date());
                 break;
+            case 7 :
+                RandomFilename = "certificate"+"/"+sdf.format(new Date());
+                break;
         }
 
         return RandomFilename;
@@ -178,6 +181,27 @@ public class OssServiceImpl implements OssService {
         }
     }
 
+    @Override
+    public String uploadInputStream(InputStream inputStream, Integer imageStatus) throws Exception {
+        try{
+            OssRequest ossRequest = new OssRequest();
+            ossRequest.setImageStatus(7);
+            String fileName = ALIYUN_OSS_DIR_PREFIX+generateRandomFilename(ossRequest)+".jpg";
+
+            //调用oss方法实现上传
+            //第一个参数  Bucket名称
+            //第二个参数  上传到oss文件路径和文件名称   aa/bb/1.jpg
+            //第三个参数  上传文件输入流
+            PutObjectResult putObjectResult = ossClient.putObject(ALIYUN_OSS_BUCKET_NAME, fileName, inputStream);
+            // 关闭OSSClient。
+            //ossClient.shutdown();
+            return fileName;
+        }catch(Exception e) {
+            e.printStackTrace();
+            throw new IllegalStateException("上传失败");
+        }
+    }
+
     @Override
     public void closeClient(){
         ossClient.shutdown();

+ 169 - 28
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.base.bo.CertificateTpAddBo;
 import com.zhongzheng.modules.base.bo.CertificateTpEditBo;
 import com.zhongzheng.modules.base.bo.CertificateTpQueryBo;
@@ -22,6 +24,10 @@ import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
+import com.zhongzheng.modules.user.bo.UserCertificateAddBo;
+import com.zhongzheng.modules.user.service.IUserCertificateService;
+import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -34,10 +40,8 @@ import javax.validation.Valid;
 import javax.validation.Validation;
 import java.awt.*;
 import java.awt.image.BufferedImage;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.io.*;
+import java.util.*;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -54,6 +58,12 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     private IGoodsService iGoodsService;
     @Autowired
     private IClassGradeUserService iClassGradeUserService;
+    @Autowired
+    private IUserCertificateService iUserCertificateService;
+    @Autowired
+    private IUserService iUserService;
+    @Autowired
+    private OssService ossService;
 
     @Override
     public CertificateTpVo queryById(Long tpId){
@@ -117,8 +127,12 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
      */
     @Override
     public String makeCertificatePhoto(ClassGradeUserQueryBo bo) {
+        if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())){
+            throw new CustomException("数据错误");
+        }
         GoodsVo goodsVo = iGoodsService.selectDetail(bo.getGoodsId());
         List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+        UserVo userVo = iUserService.queryById(bo.getUserId());
         if(Validator.isNotEmpty(goodsVo.getCertificateIds())){
             String[] s = goodsVo.getCertificateIds().split(",");
             List<Long> tpIds = new ArrayList<>();
@@ -127,71 +141,135 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
             }
             CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
             queryBo.setTpIds(tpIds);
-            List<CertificateTpVo> list = queryList(queryBo);
+            queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+            List<CertificateTpVo> list = selectList(queryBo);
+            String nowDate = DateUtils.getDate();
             for(CertificateTpVo tpVo : list){
                 if("certificate01".equals(tpVo.getKeyValue())){
                     CertificatePhotoVo vo = new CertificatePhotoVo();
-                    vo.setCode("XYZC21011234");
-                    vo.setRealname("李盛仁");
-                    vo.setIdCard("445224199901040003");
+                    String code = "XYZC"+nowDate.substring(2, 4)+"01"+getCertificateCode();
+                    vo.setCode(code);
+                    vo.setRealname(userVo.getRealname());
+                    vo.setIdCard(userVo.getIdCard());
                     String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
                     vo.setYear(date.substring(0, 4));
                     vo.setType("专业");
                     vo.setMajor("网络班");
                     vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(DateUtils.getDate().substring(0, 4));
-                    vo.setDateM(DateUtils.getDate().substring(5, 2));
-                    vo.setDateD(DateUtils.getDate().substring(7, 2));
+                    vo.setDateY(nowDate.substring(0, 4));
+                    vo.setDateM(nowDate.substring(5, 7));
+                    vo.setDateD(nowDate.substring(8, 10));
                     List<String> chapterListTxt = changeChapterList(chapterList);
+                    vo.setChapterList(chapterListTxt);
+                    String ossPath = drawPic(vo);
 
+                    UserCertificateAddBo addBo = new UserCertificateAddBo();
+                    addBo.setUserId(bo.getUserId());
+                    addBo.setGoodsId(bo.getGoodsId());
+                    addBo.setGradeId(bo.getGradeId());
+                    addBo.setCertificateTpId(tpVo.getTpId());
+                    addBo.setCertificateCode(code);
+                    addBo.setCertificatePath(ossPath);
+                    addBo.setClassHours(goodsVo.getClassHours());
+                    addBo.setEducationTypeId(goodsVo.getEducationTypeId());
+                    addBo.setProjectId(goodsVo.getProjectId());
+                    addBo.setBusinessId(goodsVo.getBusinessId());
+                    iUserCertificateService.insertByAddBo(addBo);
+
+                }
+                else if("certificate02".equals(tpVo.getKeyValue())){
+                    CertificatePhotoVo vo = new CertificatePhotoVo();
+                    String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
+                    vo.setCode(code);
+                    vo.setRealname(userVo.getRealname());
+                    vo.setIdCard(userVo.getIdCard());
+                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+                    vo.setYear(date.substring(0, 4));
+                    vo.setType("选修");
+                    vo.setMajor("网络班");
+                    vo.setClassHours(goodsVo.getClassHours()+"");
+                    vo.setDateY(nowDate.substring(0, 4));
+                    vo.setDateM(nowDate.substring(5, 7));
+                    vo.setDateD(nowDate.substring(8, 10));
+                    List<String> chapterListTxt = changeChapterList(chapterList);
                     vo.setChapterList(chapterListTxt);
                     drawPic(vo);
 
                 }
-            }
+                else if("certificate03".equals(tpVo.getKeyValue())){
+                    CertificatePhotoVo vo = new CertificatePhotoVo();
+                    String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
+                    vo.setCode(code);
+                    vo.setRealname(userVo.getRealname());
+                    vo.setIdCard(userVo.getIdCard());
+                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+                    vo.setYear(date.substring(0, 4));
+                    vo.setType("选修");
+                    vo.setMajor("网络班");
+                    String sex = "男";
+                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                        sex = "女";
+                    }
+                    vo.setSex(sex);
+                    vo.setClassHours(goodsVo.getClassHours()+"");
+                    vo.setDateY(nowDate.substring(0, 4));
+                    vo.setDateM(nowDate.substring(5, 7));
+                    vo.setDateD(nowDate.substring(8, 10));
+                    vo.setMajor("一级建造师继续教育培训");
+                    vo.setRemark1("其中必修");
+                    vo.setRemark2("课 60 学时,测试成绩合格。");
+                    List<String> chapterListTxt = changeChapterList(chapterList);
+                    vo.setChapterList(chapterListTxt);
+                    drawPicOneBuild(vo);
 
+                }
+            }
         }
         return null;
     }
-    private String getCertificateCode(List<CourseChapterVo> chapterList){
-        return null;
+    private String getCertificateCode(){
+        Long id = iUserCertificateService.selectMaxId();
+        String nowId = Long.toString(id);
+        String result = "";
+        result = String.format("%0" + 4 + "d", Integer.parseInt(nowId) + 1);
+        return result;
     }
+
     private List<String> changeChapterList(List<CourseChapterVo> chapterList){
         List<String> chapterListTxt = new ArrayList<>();
         for(int i =0; i<chapterList.size(); i++){
             String numTag = "";
             if(i==0){
-                numTag = "①.";
+                numTag = "①. ";
             }
             else if(i==1){
-                numTag = "②.";
+                numTag = "②. ";
             }
             else if(i==2){
-                numTag = "③.";
+                numTag = "③. ";
             }
             else if(i==3){
-                numTag = "④.";
+                numTag = "④. ";
             }
             else if(i==4){
-                numTag = "⑤.";
+                numTag = "⑤. ";
             }
             else if(i==5){
-                numTag = "⑥.";
+                numTag = "⑥. ";
             }
             else if(i==6){
-                numTag = "⑦.";
+                numTag = "⑦. ";
             }
             else if(i==7){
-                numTag = "⑧.";
+                numTag = "⑧. ";
             }
             chapterListTxt.add(numTag+chapterList.get(i).getName());
         }
         return chapterListTxt;
     }
 
-    private  String drawPic(CertificatePhotoVo entity){
+    private String drawPic(CertificatePhotoVo entity){
         Font font = new Font("微软雅黑", Font.PLAIN, 45);// 添加字体的属性设置
-
         String projectUrl = "D:\\test\\";
         String imgName = projectUrl + "out01.jpg";
         try {
@@ -203,7 +281,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
 
             // 设置文本样式
             g.setFont(font);
-            g.setColor(Color.BLACK);
+            g.setColor(Color.DARK_GRAY);
 
             g.drawString(entity.getCode(), 445, 290);
             g.drawString(entity.getRealname(), 488, 562);
@@ -212,9 +290,6 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
             g.drawString(entity.getType(), 780, 679);
             g.drawString(entity.getMajor(), 1175, 679);
             g.drawString(entity.getClassHours(), 953, 788);
-            g.drawString(entity.getDateY(), 2280, 1599);
-            g.drawString(entity.getDateM(), 2505, 1599);
-            g.drawString(entity.getDateD(), 2712, 1599);
             int x = 493;
             int y = 999;
             int i=0;
@@ -231,6 +306,60 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                     break;
                 }
             }
+            g.setColor(Color.BLACK);
+            g.drawString(entity.getDateY(), 2280, 1599);
+            g.drawString(entity.getDateM(), 2505, 1599);
+            g.drawString(entity.getDateD(), 2712, 1599);
+            // 完成模板修改
+            g.dispose();
+            // 获取新文件的地址
+            File outputfile = new File(imgName);
+            // 生成新的合成过的用户二维码并写入新图片
+    //        ImageIO.write(imageLocal, "jpg", outputfile);
+            //上传OSS
+            InputStream is =  bufferedImageToInputStream(imageLocal);
+            return ossService.uploadInputStream(is,7);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private  String drawPicOneBuild(CertificatePhotoVo entity){
+        Font font = new Font("宋体", Font.PLAIN, 20);// 添加字体的属性设置 微软雅黑
+
+        String projectUrl = "D:\\test\\";
+        String imgName = projectUrl + "out02.jpg";
+        try {
+            // 加载本地图片
+            String imageLocalUrl = projectUrl + "003.jpg";
+            BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            // 以本地图片为模板
+            Graphics2D g = imageLocal.createGraphics();
+
+            // 设置文本样式
+            g.setFont(font);
+            g.setColor(Color.BLACK);
+
+            g.drawString(entity.getCode(), 273, 635);
+            g.drawString(entity.getRealname(), 828, 265);
+            g.drawString(entity.getSex(), 1015, 265);
+            g.drawString(entity.getIdCard(), 833, 315);
+            g.drawString(entity.getDateY(), 780, 365);
+            g.drawString(entity.getDateM(), 905, 365);
+            g.drawString(entity.getMajor(), 736, 408);
+            g.drawString(entity.getRemark1(), 1035, 408);
+            g.drawString(entity.getRemark2(), 730, 460);
+
+            g.drawString(entity.getDateY(), 707, 677);
+            g.drawString(entity.getDateM(), 783, 677);
+            g.drawString(entity.getDateD(), 835, 677);
+
+            g.drawString(entity.getDateY(), 945, 677);
+            g.drawString(entity.getDateM(), 1019, 677);
+            g.drawString(entity.getDateD(), 1071, 677);
+
             // 完成模板修改
             g.dispose();
             // 获取新文件的地址
@@ -246,6 +375,18 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         return imgName;
     }
 
+    public InputStream bufferedImageToInputStream(BufferedImage image){
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        try {
+            ImageIO.write(image, "png", os);
+            InputStream input = new ByteArrayInputStream(os.toByteArray());
+            return input;
+        } catch (IOException e) {
+
+        }
+        return null;
+    }
+
     @Override
     public List<CertificateTpVo> selectList(CertificateTpQueryBo bo) {
         return this.baseMapper.selectList(bo);

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/CertificatePhotoVo.java

@@ -27,6 +27,8 @@ public class CertificatePhotoVo {
 
 	@ApiModelProperty("年份")
 	private String year;
+	@ApiModelProperty("性别")
+	private String sex;
 
 	@ApiModelProperty("课程类型")
 	private String type;
@@ -42,4 +44,9 @@ public class CertificatePhotoVo {
 	private String dateM;
 	@ApiModelProperty("审核日期日")
 	private String dateD;
+	@ApiModelProperty("说明1")
+	private String remark1;
+	@ApiModelProperty("说明2")
+	private String remark2;
+
 }

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

@@ -30,8 +30,8 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
      */
     @Override
     public void insertOperlog(SysOperLog operLog) {
-        operLog.setOperTime(new Date());
-        save(operLog);
+        /*operLog.setOperTime(new Date());
+        save(operLog);*/
     }
 
     /**

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateAddBo.java

@@ -47,7 +47,7 @@ public class UserCertificateAddBo {
     private Long trainEndTime;
     /** 学时 */
     @ApiModelProperty("学时")
-    private Long classHours;
+    private Integer classHours;
     /** 证书图片地址 */
     @ApiModelProperty("证书图片地址")
     private String certificatePath;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateEditBo.java

@@ -56,7 +56,7 @@ public class UserCertificateEditBo {
 
     /** 学时 */
     @ApiModelProperty("学时")
-    private Long classHours;
+    private Integer classHours;
     /** 证书图片地址 */
     @ApiModelProperty("证书图片地址")
     private String certificatePath;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateQueryBo.java

@@ -59,7 +59,7 @@ public class UserCertificateQueryBo extends BaseEntity {
 	private Long trainEndTime;
 	/** 学时 */
 	@ApiModelProperty("学时")
-	private Long classHours;
+	private Integer classHours;
 	/** 证书图片地址 */
 	@ApiModelProperty("证书图片地址")
 	private String certificatePath;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserCertificate.java

@@ -47,7 +47,7 @@ private static final long serialVersionUID=1L;
     /** 培训结束时间 */
     private Long trainEndTime;
     /** 学时 */
-    private Long classHours;
+    private Integer classHours;
     /** 证书图片地址 */
     private String certificatePath;
     /** 教育类型id */

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserCertificateMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.user.bo.UserCertificateQueryBo;
 import com.zhongzheng.modules.user.domain.UserCertificate;
+import com.zhongzheng.modules.user.vo.UserCertificateVo;
+
+import java.util.List;
 
 /**
  * 用户证书Mapper接口
@@ -10,5 +14,6 @@ import com.zhongzheng.modules.user.domain.UserCertificate;
  * @date 2022-02-17
  */
 public interface UserCertificateMapper extends BaseMapper<UserCertificate> {
-
+    Long selectMaxId();
+    List<UserCertificateVo> selectList(UserCertificateQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserCertificateService.java

@@ -23,11 +23,15 @@ public interface IUserCertificateService extends IService<UserCertificate> {
 	 */
 	UserCertificateVo queryById(Long id);
 
+	Long selectMaxId();
+
 	/**
 	 * 查询列表
 	 */
 	List<UserCertificateVo> queryList(UserCertificateQueryBo bo);
 
+	List<UserCertificateVo> selectList(UserCertificateQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入用户证书
 	 * @param bo 用户证书新增业务对象

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserCertificateServiceImpl.java

@@ -36,6 +36,11 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateMappe
         return BeanUtil.toBean(db, UserCertificateVo.class);
     }
 
+    @Override
+    public Long selectMaxId() {
+        return this.baseMapper.selectMaxId();
+    }
+
     @Override
     public List<UserCertificateVo> queryList(UserCertificateQueryBo bo) {
         LambdaQueryWrapper<UserCertificate> lqw = Wrappers.lambdaQuery();
@@ -50,6 +55,11 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateMappe
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<UserCertificateVo> selectList(UserCertificateQueryBo bo) {
+        return this.baseMapper.selectList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 24 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserCertificateVo.java

@@ -55,7 +55,7 @@ public class UserCertificateVo {
 	/** 学时 */
 	@Excel(name = "学时")
 	@ApiModelProperty("学时")
-	private Long classHours;
+	private Integer classHours;
 	/** 证书图片地址 */
 	@Excel(name = "证书图片地址")
 	@ApiModelProperty("证书图片地址")
@@ -64,4 +64,27 @@ public class UserCertificateVo {
 	@Excel(name = "项目ID")
 	@ApiModelProperty("项目ID")
 	private Long projectId;
+	/** 教育类型id */
+	@Excel(name = "教育类型id")
+	@ApiModelProperty("教育类型id")
+	private Long educationTypeId;
+	/** 业务层次id */
+	@Excel(name = "业务层次id")
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
+
+	@ApiModelProperty("证书类型名")
+	private String certificateName;
+	@ApiModelProperty("证书名")
+	private String title;
+	@ApiModelProperty("身份证")
+	private String idCard;
+	@ApiModelProperty("姓名")
+	private String realname;
+	@ApiModelProperty("教育名称")
+	private String educationName;
+	@ApiModelProperty("项目名称")
+	private String projectName;
+	@ApiModelProperty("业务名称")
+	private String businessName;
 }

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

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zhongzheng.system.mapper.UserCertificateMapper">
+<mapper namespace="com.zhongzheng.modules.user.mapper.UserCertificateMapper">
 
     <resultMap type="com.zhongzheng.modules.user.domain.UserCertificate" id="UserCertificateResult">
         <result property="id" column="id"/>
@@ -22,6 +22,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="projectId" column="project_id"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.user.vo.UserCertificateVo" id="UserCertificateVoResult">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="gradeId" column="grade_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="certificateTpId" column="certificate_tp_id"/>
+        <result property="certificateCode" column="certificate_code"/>
+        <result property="trainStartTime" column="train_start_time"/>
+        <result property="trainEndTime" column="train_end_time"/>
+        <result property="classHours" column="class_hours"/>
+        <result property="certificatePath" column="certificate_path"/>
+        <result property="educationTypeId" column="education_type_id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="projectId" column="project_id"/>
+
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+        <result property="realname" column="realname"/>
+        <result property="idCard" column="id_card"/>
+        <result property="title" column="title"/>
+        <result property="certificateName" column="certificate_name"/>
+    </resultMap>
 
+    <select id="selectMaxId"   resultType="Long">
+        SELECT  IFNULL(max(id),0) from user_certificate
+    </select>
 
+    <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserCertificateQueryBo" resultMap="UserCertificateVoResult">
+        SELECT
+            uc.*,
+            u.realname,
+            u.id_card,
+            ct.title,
+            c.certificate_name,
+            cet.education_name,
+            cpt.project_name,
+            cb.business_name
+        FROM
+            user_certificate uc
+                LEFT JOIN `user` u ON uc.user_id = u.user_id
+                LEFT JOIN certificate_tp ct ON uc.certificate_tp_id = ct.tp_id
+                LEFT JOIN certificate c ON ct.type_id = c.id
+                LEFT JOIN course_education_type cet ON uc.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON uc.project_id = cpt.id
+                LEFT JOIN course_business cb ON uc.business_id = cb.id
+    </select>
 </mapper>