renqianlong há 1 ano atrás
pai
commit
092cd247ef

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/pdf/PdfUtils.java

@@ -342,7 +342,7 @@ public class PdfUtils extends PdfPageEventHelper {
             Paragraph paragraph5 = new Paragraph("三、协议有效期与结算标准", headfont);
             paragraph5.setIndentationRight(2);//右缩进2格
             document.add(paragraph5);
-            Date startDate = DateUtils.timeToDate(vo.getApplyTime());
+            Date startDate = DateUtils.timeToDate(vo.getStartTime());
             Date endDate = DateUtils.timeToDate(vo.getEndTime());
             int statYear = startDate.getYear() + 1900;
             int endYear = endDate.getYear() + 1900;

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/pdf/bo/BsCovenantExportVo.java

@@ -31,7 +31,7 @@ public class BsCovenantExportVo {
 	/** 申请时间 */
 	@Excel(name = "申请时间")
 	@ApiModelProperty("申请时间")
-	private Long applyTime;
+	private Long startTime;
 	/** 结束时间 */
 	@Excel(name = "结束时间")
 	@ApiModelProperty("结束时间")

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantAddBo.java

@@ -23,7 +23,7 @@ public class BsCovenantAddBo {
     private String covenantNum;
     /** 申请时间 */
     @ApiModelProperty("开始时间")
-    private Long applyTime;
+    private Long startTime;
     /** 结束时间 */
     @ApiModelProperty("结束时间")
     private Long endTime;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantEditBo.java

@@ -31,7 +31,7 @@ public class BsCovenantEditBo {
 
     /** 申请时间 */
     @ApiModelProperty("开始时间")
-    private Long applyTime;
+    private Long startTime;
 
     /** 结束时间 */
     @ApiModelProperty("结束时间")

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantQueryBo.java

@@ -47,7 +47,7 @@ public class BsCovenantQueryBo extends BaseEntity {
 	private String covenantNum;
 	/** 申请时间 */
 	@ApiModelProperty("开始时间")
-	private Long applyTime;
+	private Long startTime;
 	/** 结束时间 */
 	@ApiModelProperty("结束时间")
 	private Long endTime;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/domain/BsCovenant.java

@@ -37,7 +37,7 @@ public class BsCovenant implements Serializable {
     /**
      * 申请时间
      */
-    private Long applyTime;
+    private Long startTime;
     /**
      * 结束时间
      */

+ 28 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/BsCovenantServiceImpl.java

@@ -29,6 +29,7 @@ import com.zhongzheng.modules.bs.covenant.vo.BsCovenantGoodsVo;
 import com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo;
 import com.zhongzheng.modules.bs.covenant.vo.NoCheckInfo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
+import com.zhongzheng.modules.course.domain.Major;
 import com.zhongzheng.modules.course.service.ICourseBusinessService;
 import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
 import com.zhongzheng.modules.course.service.ICourseProjectTypeService;
@@ -119,7 +120,11 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                     bsCovenantGoodsVos.forEach(bsCovenantGoodsVo -> {
                         Goods goods = iGoodsService.getById(bsCovenantGoodsVo.getGoodsId());
                         bsCovenantGoodsVo.setGoodsName(goods.getGoodsName());
-                        bsCovenantGoodsVo.setMajorName(iMajorService.getById(goods.getMajorId()).getCategoryName());
+                        Long majorId = goods.getMajorId();
+                        if (ObjectUtils.isNotNull(majorId)){
+                            Major byId = iMajorService.getById(majorId);
+                            bsCovenantGoodsVo.setMajorName(byId.getCategoryName());
+                        }
                         bsCovenantGoodsVo.setStandPrice(goods.getStandPrice());
                         covenantGoodsVos.add(bsCovenantGoodsVo);
                     });
@@ -260,7 +265,8 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                     if (!bo.getBsCovenantBusinessList().isEmpty()) {
                         //写入协议业务类型
                         bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
-                            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
+                            bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
                             bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
                             bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
                             bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
@@ -283,11 +289,14 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                         });
                     }
                 }
+            }else {
+                throw new CustomException("请选择是否复制协议数据");
             }
-            throw new CustomException("请选择是否复制协议数据");
         }
         bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
-            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
+            bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
+            bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
             bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
             bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
             bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
@@ -384,8 +393,10 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                         if (!bo.getBsCovenantBusinessList().isEmpty()) {
                             //写入协议业务类型
                             bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
-                                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
+                                bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
                                 bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+                                bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
                                 bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
                                 bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
                                 bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
@@ -408,12 +419,15 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                             });
                         }
                     }
+                }else {
+                    throw new CustomException("请选择是否复制协议数据");
                 }
-                throw new CustomException("请选择是否复制协议数据");
             }
             bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
-                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
+                bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
                 bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+                bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
                 bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
                 bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
                 bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
@@ -511,8 +525,9 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                             if (!bo.getBsCovenantBusinessList().isEmpty()) {
                                 //写入协议业务类型
                                 bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessVo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessVo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
                                     BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
+                                    covenantBusiness.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
                                     covenantBusiness.setBusinessId(courseBusiness.getId());
                                     covenantBusiness.setCreateTime(DateUtils.getNowTime());
                                     covenantBusiness.setUpdateTime(DateUtils.getNowTime());
@@ -535,12 +550,14 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                                 });
                             }
                         }
+                    }else {
+                        throw new CustomException("请选择是否复制协议数据");
                     }
-                    throw new CustomException("请选择是否复制协议数据");
                 }
                 bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessVo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessVo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
                     BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
+                    covenantBusiness.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
                     covenantBusiness.setBusinessId(courseBusiness.getId());
                     covenantBusiness.setCreateTime(DateUtils.getNowTime());
                     covenantBusiness.setUpdateTime(DateUtils.getNowTime());
@@ -614,7 +631,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
         }
         BsCovenantExportVo bean = BeanUtil.toBean(bsCovenantVo, BsCovenantExportVo.class);
         String zhiyuan = System.getProperty("user.dir");
-        String toPath = zhiyuan + "/zhongzheng-admin-business/src/main/resources/" + "培训服务协议" + ".pdf";
+        String toPath = zhiyuan + "/zhongzheng-admin-business/src/main/resources/" +DateUtils.getNowTime()+ "培训服务协议" + ".pdf";
         String uploadPdf = null;
         //生成协议pdf文件
         PdfUtils.downloadPdf(bean, toPath, sysTenantAccountVo);

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/vo/BsCovenantVo.java

@@ -34,7 +34,7 @@ public class BsCovenantVo {
 	/** 申请时间 */
 	@Excel(name = "开始时间")
 	@ApiModelProperty("开始时间")
-	private Long applyTime;
+	private Long startTime;
 	/** 结束时间 */
 	@Excel(name = "结束时间")
 	@ApiModelProperty("结束时间")

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/covenant/BsCovenantMapper.xml

@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="com.zhongzheng.modules.bs.covenant.domain.BsCovenant" id="BsCovenantResult">
         <result property="covenantId" column="covenant_id"/>
         <result property="covenantNum" column="covenant_num"/>
-        <result property="applyTime" column="apply_time"/>
+        <result property="startTime" column="start_time"/>
         <result property="endTime" column="end_time"/>
         <result property="status" column="status"/>
         <result property="stopStatus" column="stop_status"/>
@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo" id="BsCovenantVoResult">
         <result property="covenantId" column="covenant_id"/>
         <result property="covenantNum" column="covenant_num"/>
-        <result property="applyTime" column="apply_time"/>
+        <result property="startTime" column="start_time"/>
         <result property="endTime" column="end_time"/>
         <result property="status" column="status"/>
         <result property="covenantImg" column="covenant_img"/>