renqianlong 1 年間 前
コミット
c65c25f79c
32 ファイル変更641 行追加962 行削除
  1. 10 5
      zhongzheng-admin-business/src/main/java/com/zhongzheng/controller/covenant/BsCovenantController.java
  2. 0 112
      zhongzheng-admin-business/src/main/java/com/zhongzheng/controller/covenant/TenantCovenantInfoController.java
  3. 92 27
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/covenant/BsCovenantController.java
  4. 0 50
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/covenant/TenantCovenantInfoController.java
  5. 9 8
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantAddBo.java
  6. 7 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantBusinessAddBo.java
  7. 2 9
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantEditBo.java
  8. 1 7
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/BsCovenantQueryBo.java
  9. 7 17
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoAddBo.java
  10. 0 45
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoEditBo.java
  11. 0 54
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoQueryBo.java
  12. 101 33
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/domain/BsCovenant.java
  13. 0 47
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/domain/TenantCovenantInfo.java
  14. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/mapper/BsCovenantBusinessMapper.java
  15. 0 15
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/mapper/TenantCovenantInfoMapper.java
  16. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/IBsCovenantBusinessService.java
  17. 20 5
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/IBsCovenantService.java
  18. 0 53
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/ITenantCovenantInfoService.java
  19. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/BsCovenantBusinessServiceImpl.java
  20. 344 266
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/BsCovenantServiceImpl.java
  21. 0 124
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/TenantCovenantInfoServiceImpl.java
  22. 2 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/vo/BsCovenantVo.java
  23. 0 42
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/vo/TenantCovenantInfoVo.java
  24. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantAddBo.java
  25. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantEditBo.java
  26. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantQueryBo.java
  27. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java
  28. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/vo/SysTenantVo.java
  29. 15 1
      zhongzheng-system/src/main/resources/mapper/modules/covenant/BsCovenantBusinessMapper.xml
  30. 6 10
      zhongzheng-system/src/main/resources/mapper/modules/covenant/BsCovenantMapper.xml
  31. 0 19
      zhongzheng-system/src/main/resources/mapper/modules/covenant/TenantCovenantInfoMapper.xml
  32. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/system/SysTenantMapper.xml

+ 10 - 5
zhongzheng-admin-business/src/main/java/com/zhongzheng/controller/covenant/BsCovenantController.java

@@ -17,6 +17,7 @@ import com.zhongzheng.modules.bs.covenant.bo.BsCovenantQueryBo;
 import com.zhongzheng.modules.bs.covenant.service.IBsCovenantService;
 import com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo;
 import com.zhongzheng.modules.bs.covenant.vo.NoCheckInfo;
+import com.zhongzheng.modules.bs.system.domain.BsSysUser;
 import com.zhongzheng.modules.records.vo.CovenantCheckRecordVo;
 import lombok.RequiredArgsConstructor;
 import lombok.SneakyThrows;
@@ -158,8 +159,9 @@ public class BsCovenantController extends BaseController {
     @ApiOperation("判断当前业务类型是否有已知存在协议")
     @Log(title = "企业协议" , businessType = BusinessType.DELETE)
     @PostMapping("/judgeBusiness")
-    public AjaxResult judgeBusiness(@RequestParam("businessId") Long businessId,@RequestParam("projectId") Long projectId) {
-        return AjaxResult.success(iBsCovenantService.getCovenantNum(businessId,projectId));
+    public AjaxResult judgeBusiness(@RequestParam("businessId") Long businessId) {
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.getJudgeBusiness(businessId,userId));
     }
     @ApiOperation(value = "导出协议pdf培训服务证书")
     @GetMapping("/download")
@@ -234,7 +236,8 @@ public class BsCovenantController extends BaseController {
     @Log(title = "企业协议" , businessType = BusinessType.DELETE)
     @PostMapping("/countNoCheckNum")
     public AjaxResult countNoCheckNum() {
-        return AjaxResult.success(iBsCovenantService.countNoCheckNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countNoCheckNum(userId,2L));
     }
     /**
      * 删除企业协议
@@ -243,13 +246,15 @@ public class BsCovenantController extends BaseController {
     @Log(title = "企业协议" , businessType = BusinessType.DELETE)
     @PostMapping("/countStopNoCheckNum")
     public AjaxResult countStopNoCheckNum() {
-        return AjaxResult.success(iBsCovenantService.countStopNoCheckNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countStopNoCheckNum(userId,2L));
     }
     @ApiOperation("统计协议上传数量")
     @Log(title = "企业协议" , businessType = BusinessType.DELETE)
     @PostMapping("/countUploadImgNum")
     public AjaxResult countUploadImgNum() {
-        return AjaxResult.success(iBsCovenantService.countUploadImgNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countUploadImgNum(userId,2L));
     }
     @ApiOperation("获取审核意见列表")
     @Log(title = "企业协议" , businessType = BusinessType.DELETE)

+ 0 - 112
zhongzheng-admin-business/src/main/java/com/zhongzheng/controller/covenant/TenantCovenantInfoController.java

@@ -1,112 +0,0 @@
-package com.zhongzheng.controller.covenant;
-
-import java.util.List;
-import java.util.Arrays;
-
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoEditBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoQueryBo;
-import com.zhongzheng.modules.bs.covenant.service.ITenantCovenantInfoService;
-import com.zhongzheng.modules.bs.covenant.vo.TenantCovenantInfoVo;
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.zhongzheng.common.annotation.Log;
-import com.zhongzheng.common.core.controller.BaseController;
-import com.zhongzheng.common.core.domain.AjaxResult;
-import com.zhongzheng.common.enums.BusinessType;
-import com.zhongzheng.common.utils.poi.ExcelUtil;
-import com.zhongzheng.common.core.page.TableDataInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 乙方协议收件信息Controller
- * 
- * @author ruoyi
- * @date 2024-05-30
- */
-@Api(value = "乙方协议收件信息控制器", tags = {"乙方协议收件信息管理"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
-@RestController
-@RequestMapping("/system/tenantInfo")
-public class TenantCovenantInfoController extends BaseController {
-
-    private final ITenantCovenantInfoService iTenantCovenantInfoService;
-
-    /**
-     * 查询乙方协议收件信息列表
-     */
-    @ApiOperation("查询乙方协议收件信息列表")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:list')")
-    @GetMapping("/list")
-    public TableDataInfo<TenantCovenantInfoVo> list(TenantCovenantInfoQueryBo bo) {
-        startPage();
-        List<TenantCovenantInfoVo> list = iTenantCovenantInfoService.queryList(bo);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出乙方协议收件信息列表
-     */
-    @ApiOperation("导出乙方协议收件信息列表")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:export')")
-    @Log(title = "乙方协议收件信息", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult<TenantCovenantInfoVo> export(TenantCovenantInfoQueryBo bo) {
-        List<TenantCovenantInfoVo> list = iTenantCovenantInfoService.queryList(bo);
-        ExcelUtil<TenantCovenantInfoVo> util = new ExcelUtil<TenantCovenantInfoVo>(TenantCovenantInfoVo.class);
-        return util.exportExcel(list, "乙方协议收件信息");
-    }
-
-    /**
-     * 获取乙方协议收件信息详细信息
-     */
-    @ApiOperation("获取乙方协议收件信息详细信息")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:query')")
-    @GetMapping("/{infoId}")
-    public AjaxResult<TenantCovenantInfoVo> getInfo(@PathVariable("infoId" ) Long infoId) {
-        return AjaxResult.success(iTenantCovenantInfoService.queryById(infoId));
-    }
-
-    /**
-     * 新增乙方协议收件信息
-     */
-    @ApiOperation("新增乙方协议收件信息")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:add')")
-    @Log(title = "乙方协议收件信息", businessType = BusinessType.INSERT)
-    @PostMapping()
-    public AjaxResult<Void> add(@RequestBody TenantCovenantInfoAddBo bo) {
-        return toAjax(iTenantCovenantInfoService.insertByAddBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 修改乙方协议收件信息
-     */
-    @ApiOperation("修改乙方协议收件信息")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:edit')")
-    @Log(title = "乙方协议收件信息", businessType = BusinessType.UPDATE)
-    @PutMapping()
-    public AjaxResult<Void> edit(@RequestBody TenantCovenantInfoEditBo bo) {
-        return toAjax(iTenantCovenantInfoService.updateByEditBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 删除乙方协议收件信息
-     */
-    @ApiOperation("删除乙方协议收件信息")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:remove')")
-    @Log(title = "乙方协议收件信息" , businessType = BusinessType.DELETE)
-    @DeleteMapping("/{infoIds}")
-    public AjaxResult<Void> remove(@PathVariable Long[] infoIds) {
-        return toAjax(iTenantCovenantInfoService.deleteWithValidByIds(Arrays.asList(infoIds), true) ? 1 : 0);
-    }
-}

+ 92 - 27
zhongzheng-admin/src/main/java/com/zhongzheng/controller/covenant/BsCovenantController.java

@@ -12,6 +12,7 @@ import com.zhongzheng.framework.web.service.TokenService;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantAddBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantEditBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantQueryBo;
+import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
 import com.zhongzheng.modules.bs.covenant.service.IBsCovenantService;
 import com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo;
 import com.zhongzheng.modules.bs.covenant.vo.NoCheckInfo;
@@ -27,7 +28,7 @@ import java.util.List;
 
 /**
  * 企业协议Controller
- * 
+ *
  * @author ruoyi
  * @date 2024-05-28
  */
@@ -39,6 +40,7 @@ public class BsCovenantController extends BaseController {
 
     private final IBsCovenantService iBsCovenantService;
     private final TokenService tokenService;
+
     /**
      * 查询企业协议列表
      */
@@ -52,6 +54,7 @@ public class BsCovenantController extends BaseController {
         List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
         return getDataTable(list);
     }
+
     /**
      * 查询企业协议列表
      */
@@ -65,6 +68,7 @@ public class BsCovenantController extends BaseController {
         List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
         return getDataTable(list);
     }
+
     /**
      * 查询企业协议列表
      */
@@ -78,6 +82,7 @@ public class BsCovenantController extends BaseController {
         List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
         return getDataTable(list);
     }
+
     /**
      * 查询企业协议列表
      */
@@ -91,6 +96,7 @@ public class BsCovenantController extends BaseController {
         List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
         return getDataTable(list);
     }
+
     /**
      * 查询企业协议列表
      */
@@ -105,12 +111,32 @@ public class BsCovenantController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询企业协议列表
+     */
+    @ApiOperation("查询甲乙方上一次收件信息")
+    @GetMapping("/getLastJiaInfo")
+    public AjaxResult getLastJiaInfo(BsCovenantQueryBo bo) {
+        startPage();
+        bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
+        bo.setFormApp(1L);
+        return AjaxResult.success(iBsCovenantService.getLastJiaInfo(bo));
+    }
+    /**
+     * 查询企业协议列表
+     */
+    @ApiOperation("查询乙方名称及地址")
+    @GetMapping("/getYiInfo")
+    public AjaxResult getYiInfo() {
+        return AjaxResult.success(iBsCovenantService.getYiInfo());
+    }
+
     /**
      * 获取企业协议详细信息
      */
     @ApiOperation("获取企业协议详细信息")
     @GetMapping("/{covenantId}")
-    public AjaxResult<BsCovenantVo> getInfo(@PathVariable("covenantId" ) Long covenantId) {
+    public AjaxResult<BsCovenantVo> getInfo(@PathVariable("covenantId") Long covenantId) {
         return AjaxResult.success(iBsCovenantService.queryById(covenantId));
     }
 
@@ -126,6 +152,14 @@ public class BsCovenantController extends BaseController {
         bo.setFormApp(1L);
         return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0);
     }
+
+    @ApiOperation("云学堂新增乙方信息")
+    @Log(title = "企业协议", businessType = BusinessType.INSERT)
+    @PostMapping("/insertYiInfo")
+    public AjaxResult<Void> insertYiInfo(@RequestBody TenantCovenantInfoAddBo bo) {
+        return toAjax(iBsCovenantService.insertYiInfo(bo) ? 1 : 0);
+    }
+
     /**
      * 新增企业协议
      */
@@ -142,10 +176,23 @@ public class BsCovenantController extends BaseController {
     /**
      * 修改企业协议
      */
-    @ApiOperation("修改企业协议")
+    @ApiOperation("复制新增")
     @Log(title = "企业协议", businessType = BusinessType.UPDATE)
-    @PostMapping("/updateById")
-    public AjaxResult<Void> edit(@RequestBody BsCovenantEditBo bo) {
+    @PostMapping("/copyAndInsert")
+    public AjaxResult<Void> copyAndInsert(@RequestBody BsCovenantAddBo bo) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        bo.setFormApp(3L);
+        return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改企业协议
+     */
+    @ApiOperation("修改重提")
+    @Log(title = "企业协议", businessType = BusinessType.UPDATE)
+    @PostMapping("/updateCommit")
+    public AjaxResult<Void> copyAndInsert(@RequestBody BsCovenantEditBo bo) {
         return toAjax(iBsCovenantService.updateByEditBo(bo) ? 1 : 0);
     }
 
@@ -153,121 +200,139 @@ public class BsCovenantController extends BaseController {
      * 删除企业协议
      */
     @ApiOperation("协议取消")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/cancelStatus")
     public AjaxResult<Void> cancelStatus(@RequestParam("covenantId") Long covenantId) {
         return toAjax(iBsCovenantService.deleteWithValidByIds(covenantId) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("生成协议编号")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @GetMapping("/getCovenantNum")
     public AjaxResult<Void> getCovenantNum() {
         return AjaxResult.success(iBsCovenantService.getCovenantNum());
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("判断当前业务类型是否有已知存在协议")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/judgeBusiness")
-    public AjaxResult judgeBusiness(@RequestParam("businessId") Long businessId,@RequestParam("projectId") Long projectId) {
-        return AjaxResult.success(iBsCovenantService.getCovenantNum(businessId,projectId));
+    public AjaxResult judgeBusiness(@RequestParam("businessId") Long businessId) {
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.getJudgeBusiness(businessId,userId));
     }
+
     @ApiOperation(value = "导出协议pdf培训服务证书")
     @GetMapping("/download")
     public AjaxResult download(@RequestParam("covenantId") Long covenantId) {
         return AjaxResult.success(iBsCovenantService.exportPdf(covenantId));
     }
+
     @ApiOperation(value = "云学堂判断当前选择甲方是否存在待审核或者申请终止审核")
     @GetMapping("/judgeExistYW")
     public AjaxResult judgeExistYW(@RequestParam("companyId") Long companyId) {
         return AjaxResult.success(iBsCovenantService.judgeExistYW(companyId));
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("终止申请")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/updateStopStatus")
     public AjaxResult<Void> updateStopStatus(@RequestParam("covenantId") Long covenantId) {
         return toAjax(iBsCovenantService.updateStopStatus(covenantId) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("取消终止申请")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/cancelStopStatus")
     public AjaxResult<Void> cancelStopStatus(@RequestParam("covenantId") Long covenantId) {
         return toAjax(iBsCovenantService.cancelStopStatus(covenantId) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("协议审核")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/updateCheckStatus")
     public AjaxResult updateCheckStatus(@RequestBody NoCheckInfo noCheckInfo) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        return toAjax(iBsCovenantService.updateCheckStatus(noCheckInfo,loginUser.getUser().getUserId()) ? 1 : 0);
+        return toAjax(iBsCovenantService.updateCheckStatus(noCheckInfo, loginUser.getUser().getUserId()) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("终止审核")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/updateStopCheck")
     public AjaxResult updateStopCheck(@RequestBody NoCheckInfo noCheckInfo) {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        return toAjax(iBsCovenantService.updateStopCheck(noCheckInfo,loginUser.getUser().getUserId()) ? 1 : 0);
+        return toAjax(iBsCovenantService.updateStopCheck(noCheckInfo, loginUser.getUser().getUserId()) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("协议上传")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/uploadImg")
-    public AjaxResult uploadImg(@RequestParam("covenantId") Long covenantId,@RequestParam("path") List<String> paths) {
-        return toAjax(iBsCovenantService.uploadImg(covenantId,paths) ? 1 : 0);
+    public AjaxResult uploadImg(@RequestParam("covenantId") Long covenantId, @RequestParam("path") List<String> paths) {
+        return toAjax(iBsCovenantService.uploadImg(covenantId, paths) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("协议上传确认生效")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/confirmAssert")
     public AjaxResult confirmAssert(@RequestParam("covenantId") Long covenantId) {
         return toAjax(iBsCovenantService.confirmAssert(covenantId) ? 1 : 0);
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("统计协议审核待审核数量")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/countNoCheckNum")
     public AjaxResult countNoCheckNum() {
-        return AjaxResult.success(iBsCovenantService.countNoCheckNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countNoCheckNum(userId, 1L));
     }
+
     /**
      * 删除企业协议
      */
     @ApiOperation("统计终止审核待审核数量")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/countStopNoCheckNum")
     public AjaxResult countStopNoCheckNum() {
-        return AjaxResult.success(iBsCovenantService.countStopNoCheckNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countStopNoCheckNum(userId, 1L));
     }
+
     @ApiOperation("统计协议上传数量")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @PostMapping("/countUploadImgNum")
     public AjaxResult countUploadImgNum() {
-        return AjaxResult.success(iBsCovenantService.countUploadImgNum());
+        Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
+        return AjaxResult.success(iBsCovenantService.countUploadImgNum(userId, 1L));
     }
+
     @ApiOperation("获取审核意见列表")
-    @Log(title = "企业协议" , businessType = BusinessType.DELETE)
+    @Log(title = "企业协议", businessType = BusinessType.DELETE)
     @GetMapping("/getCheckInfo")
     public TableDataInfo<CovenantCheckRecordVo> getCheckInfo(@RequestParam("covenantId") Long covenantId) {
         return getDataTable(iBsCovenantService.getNoCheckInfo(covenantId));

+ 0 - 50
zhongzheng-admin/src/main/java/com/zhongzheng/controller/covenant/TenantCovenantInfoController.java

@@ -1,50 +0,0 @@
-package com.zhongzheng.controller.covenant;
-
-import com.zhongzheng.common.annotation.Log;
-import com.zhongzheng.common.core.controller.BaseController;
-import com.zhongzheng.common.core.domain.AjaxResult;
-import com.zhongzheng.common.core.page.TableDataInfo;
-import com.zhongzheng.common.enums.BusinessType;
-import com.zhongzheng.common.utils.poi.ExcelUtil;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoEditBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoQueryBo;
-import com.zhongzheng.modules.bs.covenant.service.ITenantCovenantInfoService;
-import com.zhongzheng.modules.bs.covenant.vo.TenantCovenantInfoVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 乙方协议收件信息Controller
- * 
- * @author ruoyi
- * @date 2024-05-30
- */
-@Api(value = "乙方信息控制器", tags = {"乙方信息控制器"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
-@RestController
-@RequestMapping("/system/tenantInfo")
-public class TenantCovenantInfoController extends BaseController {
-
-    private final ITenantCovenantInfoService iTenantCovenantInfoService;
-
-
-    /**
-     * 新增、修改乙方协议收件信息
-     */
-    @ApiOperation("新增、修改乙方协议信息")
-    @PreAuthorize("@ss.hasPermi('system:tenantInfo:add')")
-    @Log(title = "乙方协议收件信息", businessType = BusinessType.INSERT)
-    @PostMapping("/insertOrUpdate")
-    public AjaxResult<Void> add(@RequestBody TenantCovenantInfoAddBo bo) {
-        return toAjax(iTenantCovenantInfoService.insertByAddBo(bo) ? 1 : 0);
-    }
-
-}

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

@@ -22,7 +22,7 @@ public class BsCovenantAddBo {
     @ApiModelProperty("协议编号")
     private String covenantNum;
     /** 申请时间 */
-    @ApiModelProperty("申请时间")
+    @ApiModelProperty("开始时间")
     private Long applyTime;
     /** 结束时间 */
     @ApiModelProperty("结束时间")
@@ -35,6 +35,7 @@ public class BsCovenantAddBo {
     @ApiModelProperty("上传状态 0 待上传 1待生效 2 已生效 ")
     private Integer uploadStatus;
 //    终止状态 0 无 1 审核中 2 不通过 3 已终止 4 已取消
+@ApiModelProperty("终止状态 0 无 1 待审核 2 审核通过 3 不通过 4 已终止 5 已取消")
     private Integer stopStatus;
     /** 结算周期(月) */
     @ApiModelProperty("结算周期(月)")
@@ -49,6 +50,7 @@ public class BsCovenantAddBo {
     @ApiModelProperty("结算周期显示状态 0:不勾选 1勾选")
     private Integer cycleStatus;
     /*1 正常 2周期预警 3金额预警 4结算预警*/
+    @ApiModelProperty("1 正常 2周期预警 3金额预警 4结算预警")
     private Integer cycleWarning;
     /** 结算上限金额 */
     @ApiModelProperty("结算上限金额")
@@ -80,15 +82,9 @@ public class BsCovenantAddBo {
     /** 甲方收件备注 */
     @ApiModelProperty("甲方收件备注")
     private String jiaRecipientsRemark;
-    /** 乙方企业id */
-    @ApiModelProperty("乙方企业id")
-    private Long yiCompanyId;
     /** 乙方企业联系人 */
     @ApiModelProperty("乙方企业联系人")
     private String yiCompanyContract;
-    /** 乙方企业地址 */
-    @ApiModelProperty("乙方企业地址")
-    private String yiCompanyAddress;
     /** 乙方电话 */
     @ApiModelProperty("乙方电话")
     private String yiCompanyPhone;
@@ -110,9 +106,14 @@ public class BsCovenantAddBo {
     /** 更新时间 */
     @ApiModelProperty("更新时间")
     private Long updateTime;
-    private List<BsCovenantBusiness> bsCovenantBusinessList;
+    private List<BsCovenantBusinessAddBo> bsCovenantBusinessList;
     /*存在已知业务类型的协议编号*/
+    @ApiModelProperty("存在已知业务类型的协议编号")
     private String copyCovenantNum;
     /*是否复制 1 复制 0不复制*/
+    @ApiModelProperty("是否复制 1 复制 0不复制")
     private Integer copyStatus;
+    /*是否复制 1 复制 0不复制*/
+    @ApiModelProperty("协议id")
+    private Long covenantId;
 }

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

@@ -1,11 +1,14 @@
 package com.zhongzheng.modules.bs.covenant.bo;
 
+import com.zhongzheng.modules.bs.covenant.domain.BsCovenantGoods;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
-import java.util.Date;
+import org.apache.catalina.LifecycleState;
 
+import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -42,4 +45,7 @@ public class BsCovenantBusinessAddBo {
     /** 更新时间 */
     @ApiModelProperty("更新时间")
     private Long updateTime;
+    /** 更新时间 */
+    @ApiModelProperty("商品信心")
+    private List<BsCovenantGoodsAddBo> bsCovenantGoods;
 }

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

@@ -30,7 +30,7 @@ public class BsCovenantEditBo {
 
 
     /** 申请时间 */
-    @ApiModelProperty("申请时间")
+    @ApiModelProperty("开始时间")
     private Long applyTime;
 
     /** 结束时间 */
@@ -100,18 +100,11 @@ public class BsCovenantEditBo {
     @ApiModelProperty("甲方收件备注")
     private String jiaRecipientsRemark;
 
-    /** 乙方企业id */
-    @ApiModelProperty("乙方企业id")
-    private Long yiCompanyId;
-
 
     /** 乙方企业联系人 */
     @ApiModelProperty("乙方企业联系人")
     private String yiCompanyContract;
 
-    /** 乙方企业地址 */
-    @ApiModelProperty("乙方企业地址")
-    private String yiCompanyAddress;
 
     /** 乙方电话 */
     @ApiModelProperty("乙方电话")
@@ -137,7 +130,7 @@ public class BsCovenantEditBo {
     @ApiModelProperty("更新时间")
     private Long updateTime;
     @ApiModelProperty("协议关联业务层次集合")
-    private List<BsCovenantBusiness> bsCovenantBusinessList;
+    private List<BsCovenantBusinessAddBo> bsCovenantBusinessList;
     /*存在已知业务类型的协议编号*/
     @ApiModelProperty("存在已知业务类型的协议编号")
     private String copyCovenantNum;

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

@@ -46,7 +46,7 @@ public class BsCovenantQueryBo extends BaseEntity {
 	@ApiModelProperty("协议编号")
 	private String covenantNum;
 	/** 申请时间 */
-	@ApiModelProperty("申请时间")
+	@ApiModelProperty("开始时间")
 	private Long applyTime;
 	/** 结束时间 */
 	@ApiModelProperty("结束时间")
@@ -105,15 +105,9 @@ public class BsCovenantQueryBo extends BaseEntity {
 	/** 甲方收件备注 */
 	@ApiModelProperty("甲方收件备注")
 	private String jiaRecipientsRemark;
-	/** 乙方企业id */
-	@ApiModelProperty("乙方企业id")
-	private Long yiCompanyId;
 	/** 乙方企业联系人 */
 	@ApiModelProperty("乙方企业联系人")
 	private String yiCompanyContract;
-	/** 乙方企业地址 */
-	@ApiModelProperty("乙方企业地址")
-	private String yiCompanyAddress;
 	/** 乙方电话 */
 	@ApiModelProperty("乙方电话")
 	private String yiCompanyPhone;

+ 7 - 17
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoAddBo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.bs.covenant.bo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -19,24 +20,13 @@ import java.util.Date;
 public class TenantCovenantInfoAddBo {
 
     /** 乙方公司名称 */
-    @ApiModelProperty("乙方公司名称")
-    private String yiCompanyName;
+    @ApiModelProperty("状态 1 开启 0 无状态" )
+    private Long Status;
     /** 乙方公司地址 */
     @ApiModelProperty("乙方公司地址")
     private String yiCompanyAddress;
-    /** 乙方联系人 */
-    @ApiModelProperty("乙方联系人")
-    private String yiCompanyContract;
-    /** 乙方联系电话 */
-    @ApiModelProperty("乙方联系电话")
-    private String yiCompanyPhone;
-    /** 状态 1有效 0无效 */
-    @ApiModelProperty("状态 1有效 0无效")
-    private Long status;
-    /** 创建时间 */
-    @ApiModelProperty("创建时间")
-    private Long createTime;
-    /** 更新时间 */
-    @ApiModelProperty("更新时间")
-    private Long updateTime;
+    /** 乙方公司名称 */
+    @TableField(exist = false)
+    @ApiModelProperty("乙方公司地址")
+    private String yiCompanyName;
 }

+ 0 - 45
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoEditBo.java

@@ -1,45 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.bo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import java.util.Date;
-
-
-/**
- * 乙方协议收件信息编辑对象 tenant_covenant_info
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-@Data
-@ApiModel("乙方信息编辑对象")
-public class TenantCovenantInfoEditBo {
-
-    /** $column.columnComment */
-    @ApiModelProperty("$column.columnComment")
-    private Long infoId;
-
-
-    /** 乙方公司名称 */
-    @ApiModelProperty("乙方公司名称")
-    private String yiCompanyName;
-    /** 乙方公司地址 */
-    @ApiModelProperty("乙方公司地址")
-    private String yiCompanyAddress;
-    /** 乙方联系人 */
-    @ApiModelProperty("乙方联系人")
-    private String yiCompanyContract;
-    /** 乙方联系电话 */
-    @ApiModelProperty("乙方联系电话")
-    private String yiCompanyPhone;
-    /** 状态 1有效 0无效 */
-    @ApiModelProperty("状态 1有效 0无效")
-    private Long status;
-    /** 创建时间 */
-    @ApiModelProperty("更新时间")
-    private Long updateTime;
-
-
-}

+ 0 - 54
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/bo/TenantCovenantInfoQueryBo.java

@@ -1,54 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.bo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.zhongzheng.common.core.domain.BaseEntity;
-
-/**
- * 乙方协议收件信息分页查询对象 tenant_covenant_info
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ApiModel("乙方信息分页查询对象")
-public class TenantCovenantInfoQueryBo extends BaseEntity {
-
-	/** 分页大小 */
-	@ApiModelProperty("分页大小")
-	private Integer pageSize;
-	/** 当前页数 */
-	@ApiModelProperty("当前页数")
-	private Integer pageNum;
-	/** 排序列 */
-	@ApiModelProperty("排序列")
-	private String orderByColumn;
-	/** 排序的方向desc或者asc */
-	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
-	private String isAsc;
-
-
-	/** 乙方公司名称 */
-	@ApiModelProperty("乙方公司名称")
-	private String yiCompanyName;
-	/** 乙方公司地址 */
-	@ApiModelProperty("乙方公司地址")
-	private String yiCompanyAddress;
-	/** 乙方联系人 */
-	@ApiModelProperty("乙方联系人")
-	private String yiCompanyContract;
-	/** 乙方联系电话 */
-	@ApiModelProperty("乙方联系电话")
-	private String yiCompanyPhone;
-	/** 状态 1有效 0无效 */
-	@ApiModelProperty("状态 1有效 0无效")
-	private Long status;
-}

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

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
+
 import java.io.Serializable;
 import java.util.Date;
 import java.math.BigDecimal;
@@ -22,71 +23,138 @@ import java.math.BigDecimal;
 @TableName("bs_covenant")
 public class BsCovenant implements Serializable {
 
-private static final long serialVersionUID=1L;
+    private static final long serialVersionUID = 1L;
 
-    /** $column.columnComment */
+    /**
+     * $column.columnComment
+     */
     @TableId(value = "covenant_id")
     private Long covenantId;
-    /** 协议编号 */
+    /**
+     * 协议编号
+     */
     private String covenantNum;
-    /** 申请时间 */
+    /**
+     * 申请时间
+     */
     private Long applyTime;
-    /** 结束时间 */
+    /**
+     * 结束时间
+     */
     private Long endTime;
-    /** 协议状态  1待审核 2 已审核 3已取消 4 不通过 5 已生效 6 已过期 7 已终止 */
+    /**
+     * 协议状态  1待审核 2 已审核 3已取消 4 不通过 5 已生效 6 已过期 7 已终止
+     */
     private Integer status;
     //终止状态 0 无 1 审核中 2 不通过 3 已终止 4 已取消
     private Integer stopStatus;
-    /** 结算周期(月) */
+    /**
+     * 结算周期(月)
+     */
     private Long settlementCycle;
-    /** 结算周期显示状态 0:不勾选 1勾选 */
-    private Integer cycleStatus;;
-    /** 创建者id*/
+    /**
+     * 结算周期显示状态 0:不勾选 1勾选
+     */
+    private Integer cycleStatus;
+    ;
+    /**
+     * 创建者id
+     */
     private Long userId;
-    /** 协议来源 1云学堂  2企业系统  3业务系统 4总平台  */
+    /**
+     * 协议来源 1云学堂  2企业系统  3业务系统 4总平台
+     */
     private Long formApp;
-    /** 结算上限金额 */
+    /**
+     * 结算上限金额
+     */
     private BigDecimal limitAmount;
-    /** 结算上限金额显示状态 0:不勾选 1勾选 */
+    /**
+     * 结算上限金额显示状态 0:不勾选 1勾选
+     */
     private Integer amountStatus;
     private String covenantImg;
     private Integer uploadStatus;
-    /** 甲方企业id */
+    /**
+     * 甲方企业id
+     */
     private Long companyId;
-    /** 甲方企业联系人 */
+    /**
+     * 甲方名称
+     */
+    @TableField(exist = false)
+    private String jiaCompanyName;
+    /**
+     * 甲方企业联系人
+     */
     private String jiaCompanyContract;
-    /** 甲方企业地址 */
+    /**
+     * 甲方企业地址
+     */
     private String jiaCompanyAddress;
-    /** 甲方电话 */
+    /**
+     * 甲方电话
+     */
     private String jiaCompanyPhone;
-    /** 甲方收件人 */
+    /**
+     * 甲方收件人
+     */
     private String jiaRecipients;
-    /** 甲方收件地址 */
+    /**
+     * 甲方收件地址
+     */
     private String jiaRecipientsAddress;
-    /** 甲方收件电话 */
+    /**
+     * 甲方收件电话
+     */
     private String jiaRecipientsPhone;
-    /** 甲方收件备注 */
+    /**
+     * 甲方收件备注
+     */
     private String jiaRecipientsRemark;
-    /** 乙方企业id */
-    private Long yiCompanyId;
-    /** 乙方企业联系人 */
-    private String yiCompanyContract;
-    /** 乙方企业地址 */
+
+    /**
+     * 乙方公司名称
+     */
+    @TableField(exist = false)
+    private String yiCompanyName;
+    /**
+     * 乙方公司地址
+     */
+    @TableField(exist = false)
     private String yiCompanyAddress;
-    /** 乙方电话 */
+    /**
+     * 乙方企业联系人
+     */
+    private String yiCompanyContract;
+    /**
+     * 乙方电话
+     */
     private String yiCompanyPhone;
-    /** 乙方收件人 */
+    /**
+     * 乙方收件人
+     */
     private String yiRecipients;
-    /** 乙方收件地址 */
+    /**
+     * 乙方收件地址
+     */
     private String yiRecipientsAddress;
-    /** 乙方收件电话 */
+    /**
+     * 乙方收件电话
+     */
     private String yiRecipientsPhone;
-    /** 乙方收件备注 */
+    /**
+     * 乙方收件备注
+     */
     private String yiRecipientsRemark;
-    /** 创建时间 */
+    /**
+     * 创建时间
+     */
     @TableField(fill = FieldFill.INSERT)
     private Long createTime;
-    /** 更新时间 */
+    /**
+     * 更新时间
+     */
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private Long updateTime;
 }

+ 0 - 47
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/domain/TenantCovenantInfo.java

@@ -1,47 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.domain;
-
-import com.baomidou.mybatisplus.annotation.*;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.Accessors;
-import java.io.Serializable;
-import java.util.Date;
-import java.math.BigDecimal;
-import com.zhongzheng.common.annotation.Excel;
-
-/**
- * 乙方信息对象 tenant_covenant_info
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-@Data
-@NoArgsConstructor
-@Accessors(chain = true)
-@TableName("tenant_covenant_info")
-public class TenantCovenantInfo implements Serializable {
-
-private static final long serialVersionUID=1L;
-
-    /** $column.columnComment */
-    @TableId(value = "info_id")
-    private Long infoId;
-    private Long tenantId;
-    /** 乙方公司名称 */
-    private String yiCompanyName;
-    /** 乙方公司地址 */
-    private String yiCompanyAddress;
-    /** 乙方联系人 */
-    private String yiCompanyContract;
-    /** 乙方联系电话 */
-    private String yiCompanyPhone;
-    /** 状态 1有效 0无效 */
-    private Long status;
-    /** 创建时间 */
-    @TableField(fill = FieldFill.INSERT)
-    private Long createTime;
-    /** 更新时间 */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Long updateTime;
-}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/mapper/BsCovenantBusinessMapper.java

@@ -2,6 +2,7 @@ package com.zhongzheng.modules.bs.covenant.mapper;
 
 import com.zhongzheng.modules.bs.covenant.domain.BsCovenantBusiness;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 协议业务层次关联Mapper接口
@@ -10,5 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @date 2024-05-28
  */
 public interface BsCovenantBusinessMapper extends BaseMapper<BsCovenantBusiness> {
+    String getCovenantNumByProjectId(@Param("projectId")Long projectId, @Param("userId")Long userId, @Param("businessId")Long businessId);
 
 }

+ 0 - 15
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/mapper/TenantCovenantInfoMapper.java

@@ -1,15 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.mapper;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zhongzheng.modules.bs.covenant.domain.TenantCovenantInfo;
-
-/**
- * 乙方协议收件信息Mapper接口
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-public interface TenantCovenantInfoMapper extends BaseMapper<TenantCovenantInfo> {
-
-}

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/IBsCovenantBusinessService.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.bs.covenant.bo.BsCovenantBusinessQueryBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantBusinessAddBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantBusinessEditBo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
 import java.util.List;
@@ -49,4 +50,11 @@ public interface IBsCovenantBusinessService extends IService<BsCovenantBusiness>
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	String getCovenantNumByProjectId(Long projectId, Long userId,Long businessId);
 }

+ 20 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/IBsCovenantService.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantAddBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantEditBo;
 import com.zhongzheng.modules.bs.covenant.bo.BsCovenantQueryBo;
+import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
 import com.zhongzheng.modules.bs.covenant.domain.BsCovenant;
 import com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo;
 import com.zhongzheng.modules.bs.covenant.vo.NoCheckInfo;
@@ -32,6 +33,15 @@ public interface IBsCovenantService extends IService<BsCovenant> {
 	 */
 	List<BsCovenantVo> queryList(BsCovenantQueryBo bo);
 
+	/**
+	 * 查询甲方上一次收件信息
+	 */
+	BsCovenant getLastJiaInfo(BsCovenantQueryBo bo);
+	/**
+	 * 查询乙方公司名称和地址
+	 */
+	TenantCovenantInfoAddBo getYiInfo();
+
 	/**
 	 * 根据新增业务对象插入企业协议
 	 * @param bo 企业协议新增业务对象
@@ -44,6 +54,11 @@ public interface IBsCovenantService extends IService<BsCovenant> {
 	 * @return
 	 */
 	Boolean insertYXTByAddBo(BsCovenantAddBo bo);
+	/**
+	 * 添加乙方收件信息
+	 * @return
+	 */
+	Boolean insertYiInfo(TenantCovenantInfoAddBo bo);
 
 	/**
 	 * 根据编辑业务对象修改企业协议
@@ -62,9 +77,9 @@ public interface IBsCovenantService extends IService<BsCovenant> {
 	String getCovenantNum();
 
 	/**
-	 * 随即生成协议编号
+	 * 判断当前协议业务类型是否存在一直协议
 	 */
-	String getCovenantNum( Long businessId,Long projectId);
+	String getJudgeBusiness(Long projectId,Long userId);
 	/**
 	 * 导出协议服务pdf文件
 	 */
@@ -100,15 +115,15 @@ public interface IBsCovenantService extends IService<BsCovenant> {
 	/**
 	 * 统计协议审核待审核数量
 	 */
-	Integer countNoCheckNum();
+	Integer countNoCheckNum(Long userId,Long formApp);
 	/**
 	 * 统计终止审核待审核数量
 	 */
-	Integer countStopNoCheckNum();
+	Integer countStopNoCheckNum(Long userId,Long formApp);
 	/**
 	 * 统计协议上传数量数量
 	 */
-	Map<String,Object> countUploadImgNum();
+	Map<String,Object> countUploadImgNum(Long userId,Long formApp);
 	/**
 	 * 返回未通过协议审核意见记录
 	 */

+ 0 - 53
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/ITenantCovenantInfoService.java

@@ -1,53 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.service;
-
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoEditBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoQueryBo;
-import com.zhongzheng.modules.bs.covenant.domain.TenantCovenantInfo;
-import com.zhongzheng.modules.bs.covenant.vo.TenantCovenantInfoVo;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * 乙方协议收件信息Service接口
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-public interface ITenantCovenantInfoService extends IService<TenantCovenantInfo> {
-	/**
-	 * 查询单个
-	 * @return
-	 */
-	TenantCovenantInfoVo queryById(Long infoId);
-
-	/**
-	 * 查询列表
-	 */
-	List<TenantCovenantInfoVo> queryList(TenantCovenantInfoQueryBo bo);
-
-	/**
-	 * 根据新增业务对象插入乙方协议收件信息
-	 * @param bo 乙方协议收件信息新增业务对象
-	 * @return
-	 */
-	Boolean insertByAddBo(TenantCovenantInfoAddBo bo);
-
-	/**
-	 * 根据编辑业务对象修改乙方协议收件信息
-	 * @param bo 乙方协议收件信息编辑业务对象
-	 * @return
-	 */
-	Boolean updateByEditBo(TenantCovenantInfoEditBo bo);
-
-	/**
-	 * 校验并删除数据
-	 * @param ids 主键集合
-	 * @param isValid 是否校验,true-删除前校验,false-不校验
-	 * @return
-	 */
-	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
-}

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/BsCovenantBusinessServiceImpl.java

@@ -102,4 +102,9 @@ public class BsCovenantBusinessServiceImpl extends ServiceImpl<BsCovenantBusines
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public String getCovenantNumByProjectId(Long projectId, Long userId, Long businessId) {
+         return this.baseMapper.getCovenantNumByProjectId(projectId,userId,businessId);
+    }
 }

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

@@ -3,14 +3,15 @@ package com.zhongzheng.modules.bs.covenant.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.zhongzheng.common.core.domain.entity.SysMenu;
-import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.Threads;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.pdf.PdfUtils;
 import com.zhongzheng.common.utils.pdf.bo.BsCovenantExportVo;
@@ -23,13 +24,14 @@ import com.zhongzheng.modules.bs.covenant.bo.*;
 import com.zhongzheng.modules.bs.covenant.domain.BsCovenant;
 import com.zhongzheng.modules.bs.covenant.domain.BsCovenantBusiness;
 import com.zhongzheng.modules.bs.covenant.domain.BsCovenantGoods;
-import com.zhongzheng.modules.bs.covenant.domain.TenantCovenantInfo;
 import com.zhongzheng.modules.bs.covenant.mapper.BsCovenantMapper;
 import com.zhongzheng.modules.bs.covenant.service.*;
 import com.zhongzheng.modules.bs.covenant.vo.BsCovenantBusinessVo;
 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.CourseProjectType;
 import com.zhongzheng.modules.course.service.ICourseBusinessService;
 import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
 import com.zhongzheng.modules.course.service.ICourseProjectTypeService;
@@ -38,28 +40,22 @@ import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.records.bo.CovenantCheckRecordAddBo;
 import com.zhongzheng.modules.records.bo.CovenantCheckRecordQueryBo;
-import com.zhongzheng.modules.records.domain.CovenantCheckRecord;
 import com.zhongzheng.modules.records.service.ICovenantCheckRecordService;
 import com.zhongzheng.modules.records.vo.CovenantCheckRecordVo;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysMenuService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
-import com.zhongzheng.modules.system.vo.SysTenantAccountVo;
-import org.apache.poi.hssf.record.DVALRecord;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.token.TokenService;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestParam;
+import springfox.documentation.spring.web.json.Json;
 
 import java.io.*;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static io.github.classgraph.utils.VersionFinder.OS;
-
 /**
  * 企业协议Service业务层处理
  *
@@ -92,8 +88,6 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
     @Autowired
     private OssService ossService;
     @Autowired
-    private ITenantCovenantInfoService iTenantCovenantInfoService;
-    @Autowired
     private ISysMenuService iSysMenuService;
     @Autowired
     private ICovenantCheckRecordService iCovenantCheckRecordService;
@@ -112,15 +106,11 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
             bsCovenantVos.forEach(bsCovenantVo -> {
                 bsCovenantVo.setCycleWarning(bo.getCycleWarning());
                 bsCovenantVo.setJiaCompanyName(iCompanyService.getById(bsCovenantVo.getCompanyId()).getCompanyName());
-                Company yiCompany = iCompanyService.getById(bsCovenantVo.getYiCompanyId());
-                if (ObjectUtils.isNotNull(yiCompany)) {
-                    bsCovenantVo.setYiCompanyName(yiCompany.getCompanyName());
-                }
                 BsCovenantBusinessQueryBo bsCovenantBusinessQueryBo = new BsCovenantBusinessQueryBo();
                 bsCovenantBusinessQueryBo.setCovenantId(bsCovenantVo.getCovenantId());
                 bsCovenantBusinessQueryBo.setStatus(1);
                 List<BsCovenantBusinessVo> bsCovenantBusinessVos = iBsCovenantBusinessService.queryList(bsCovenantBusinessQueryBo);
-                List<BsCovenantBusinessVo> newBusinessVos= new ArrayList<>();
+                List<BsCovenantBusinessVo> newBusinessVos = new ArrayList<>();
                 bsCovenantBusinessVos.forEach(bsCovenantBusiness -> {
                     bsCovenantBusiness.setBusinessName(iCourseBusinessService.getById(bsCovenantBusiness.getBusinessId()).getBusinessName());
                     bsCovenantBusiness.setEducationTypeName(iCourseEducationTypeService.getById(bsCovenantBusiness.getEducationTypeId()).getEducationName());
@@ -147,145 +137,85 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
         return covenantVoArrayList;
     }
 
-
     @Override
-    @Transactional
-    public Boolean insertByAddBo(BsCovenantAddBo bo) {
-        BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
-        add.setFormApp(2L);
-        String companyId = ServletUtils.getRequest().getHeader("companyId");
-        add.setCompanyId(Long.valueOf(companyId));
-        add.setCreateTime(DateUtils.getNowTime());
-        add.setUpdateTime(DateUtils.getNowTime());
-        TenantCovenantInfo tenantCovenantInfo = iTenantCovenantInfoService.getOne(new LambdaQueryWrapper<TenantCovenantInfo>().eq(TenantCovenantInfo::getStatus, 1));
-        add.setYiCompanyId(tenantCovenantInfo.getInfoId());
-        add.setYiCompanyContract(tenantCovenantInfo.getYiCompanyContract());
-        add.setYiCompanyAddress(tenantCovenantInfo.getYiCompanyAddress());
-        add.setYiCompanyPhone(tenantCovenantInfo.getYiCompanyPhone());
-        int insert = this.baseMapper.insert(add);
-        BsCovenant newBsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCovenantNum()).eq(BsCovenant::getStatus, 1));
-        //写入协议审核流程
-        SysTenant sysTenant = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
-        if (ObjectUtils.isNotNull(sysTenant)) {
-            List<String> list = Arrays.asList(sysTenant.getAppList());
-            list.forEach(item -> {
-                BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
-                bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                bsCovenantCheckAddBo.setCompanyId(Long.valueOf(companyId));
-                List<String> list1 = Arrays.asList(item.split(","));
-                List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
-                longList.forEach(num -> {
-                    bsCovenantCheckAddBo.setAppId(num);
-                    if (num == 1L) {
-                        bsCovenantCheckAddBo.setSort(4);
-                    } else if (num == 2L) {
-                        bsCovenantCheckAddBo.setSort(1);
-                        bsCovenantCheckAddBo.setCurrentStatus(1);
-                    } else if (num == 3L) {
-                        bsCovenantCheckAddBo.setSort(2);
-                    } else if (num == 4L) {
-                        bsCovenantCheckAddBo.setSort(3);
-                    }
-                    bsCovenantCheckAddBo.setStatus(1);
-                    bsCovenantCheckAddBo.setCreateTime(DateUtils.getNowTime());
-                    bsCovenantCheckAddBo.setUpdateTime(DateUtils.getNowTime());
-                    iBsCovenantCheckService.insertByAddBo(bsCovenantCheckAddBo);
-                });
-            });
-        }
-        if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
-            BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
-            if (ObjectUtils.isNotNull(bo.getCopyStatus())) {
-                if (bo.getCopyStatus() == 1) {
-                    //复制协议时删除复制协议相关信息
-                    if (ObjectUtils.isNotNull(bs)) {
-                        bs.setStatus(0);
-                        this.updateById(bs);
-                        iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bs.getCovenantId()));
-                        iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bs.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
-                    } else {
-                        throw new CustomException("当前协议不存在");
-                    }
-                } else if (bo.getCopyStatus() == 0) {
-                    if (!bo.getBsCovenantBusinessList().isEmpty()) {
-                        //写入协议业务类型
-                        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                            BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-                            covenantBusiness.setCovenantId(newBsCovenant.getCovenantId());
-                            covenantBusiness.setCreateTime(DateUtils.getNowTime());
-                            covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-                            iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-                            if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessVo.getBusinessId())
-                                        .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessVo.getEducationTypeId())
-                                        .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessVo.getProjectId())
-                                        .eq(BsCovenantBusiness::getStatus, 1));
-                                //写入协议业务类型有关商品
-                                bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                                    BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                                    covenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                                    covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                                    covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                                    covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                                    iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
-                                });
-                            }
-                        });
+    public BsCovenant getLastJiaInfo(BsCovenantQueryBo bo) {
+        //筛选当前用户 当前应用 当前甲方上一次协议信息缓存
+        if (bo.getCompanyId() != null) {
+            BsCovenant bsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().orderByDesc(BsCovenant::getCreateTime)
+                    .eq(BsCovenant::getUserId, bo.getUserId()).eq(BsCovenant::getFormApp, 1).eq(BsCovenant::getCompanyId, bo.getCompanyId())
+                    .last("limit 1"));
+            //筛选 当前用户 当前应用 上一次乙方信息
+            BsCovenant bsCovenant1 = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getUserId, bo.getUserId())
+                    .eq(BsCovenant::getFormApp, 1).orderByDesc(BsCovenant::getCreateTime).last("limit 1"));
+            BsCovenant newBsCovenant = new BsCovenant();
+            SysTenant tenantId = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
+            if (ObjectUtils.isNull(tenantId)) {
+                throw new CustomException("当前乙方信息为空");
+            } else {
+                String deliveryAddress = tenantId.getDeliveryAddress();
+                if (Validator.isNotEmpty(deliveryAddress)) {
+                    List<TenantCovenantInfoAddBo> tenantCovenantInfoAddBos = JSONArray.parseArray(deliveryAddress, TenantCovenantInfoAddBo.class);
+                    if (!tenantCovenantInfoAddBos.isEmpty()) {
+                        TenantCovenantInfoAddBo tenantCovenantInfoAddBo = tenantCovenantInfoAddBos.get(0);
+                        newBsCovenant.setYiCompanyAddress(tenantCovenantInfoAddBo.getYiCompanyAddress());
                     }
                 }
             }
-            throw new CustomException("请选择是否复制协议数据");
+            Company byId = iCompanyService.getById(bo.getCompanyId());
+            newBsCovenant.setCompanyId(byId.getCompanyId());
+            newBsCovenant.setJiaCompanyName(byId.getCompanyName());
+            newBsCovenant.setJiaCompanyAddress(byId.getCompanyAddress());
+            newBsCovenant.setJiaCompanyContract(byId.getCompanyContacts());
+            newBsCovenant.setJiaCompanyPhone(byId.getContactPhone());
+            newBsCovenant.setJiaRecipients(bsCovenant.getJiaRecipients());
+            newBsCovenant.setJiaRecipientsAddress(bsCovenant.getJiaRecipientsAddress());
+            newBsCovenant.setJiaRecipientsPhone(bsCovenant.getJiaRecipientsPhone());
+            newBsCovenant.setJiaRecipientsRemark(bsCovenant.getJiaRecipientsRemark());
+            newBsCovenant.setYiCompanyName(tenantId.getTenantName());
+            newBsCovenant.setYiCompanyContract(bsCovenant1.getYiCompanyContract());
+            newBsCovenant.setYiCompanyPhone(bsCovenant1.getYiCompanyPhone());
+            newBsCovenant.setYiRecipients(bsCovenant.getYiRecipients());
+            newBsCovenant.setYiCompanyContract(bsCovenant.getYiCompanyContract());
+            newBsCovenant.setYiRecipientsPhone(bsCovenant.getYiRecipientsPhone());
+            newBsCovenant.setYiRecipientsRemark(bsCovenant.getYiRecipientsRemark());
+            return newBsCovenant;
+        } else {
+            throw new CustomException("请选择甲方");
         }
-        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-            BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-            covenantBusiness.setCovenantId(newBsCovenant.getCovenantId());
-            covenantBusiness.setCreateTime(DateUtils.getNowTime());
-            covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-            iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-            if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, covenantBusiness.getBusinessId())
-                        .eq(BsCovenantBusiness::getEducationTypeId, covenantBusiness.getEducationTypeId())
-                        .eq(BsCovenantBusiness::getProjectId, covenantBusiness.getProjectId())
-                        .eq(BsCovenantBusiness::getStatus, 1));
-                //写入协议业务类型有关商品
-                bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                    BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                    covenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                    covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                    covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                    covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                    iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
-                });
-            }
-        });
-        if (insert == 1) {
-            return true;
+    }
+
+    @Override
+    public TenantCovenantInfoAddBo getYiInfo() {
+        SysTenant tenantId = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
+        if (ObjectUtils.isNull(tenantId)) {
+            throw new CustomException("当前乙方信息为空");
         } else {
-            return false;
+            String deliveryAddress = tenantId.getDeliveryAddress();
+            if (Validator.isNotEmpty(deliveryAddress)) {
+                List<TenantCovenantInfoAddBo> tenantCovenantInfoAddBos = JSONArray.parseArray(deliveryAddress, TenantCovenantInfoAddBo.class);
+                if (!tenantCovenantInfoAddBos.isEmpty()) {
+                    TenantCovenantInfoAddBo tenantCovenantInfoAddBo = tenantCovenantInfoAddBos.get(0);
+                    tenantCovenantInfoAddBo.setYiCompanyName(tenantId.getTenantName());
+                    return tenantCovenantInfoAddBo;
+                }
+            }
+            return null;
         }
     }
 
+
     @Override
     @Transactional
-    public Boolean insertYXTByAddBo(BsCovenantAddBo bo) {
+    public Boolean insertByAddBo(BsCovenantAddBo bo) {
         BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
-        if (ObjectUtils.isNotNull(bo.getCompanyId())) {
-            Company byId = iCompanyService.getById(bo.getCompanyId());
-            add.setJiaCompanyAddress(byId.getCompanyAddress());
-            add.setJiaCompanyContract(byId.getCompanyContacts());
-            add.setJiaCompanyPhone(byId.getContactPhone());
-        }
+        add.setFormApp(2L);
         String companyId = ServletUtils.getRequest().getHeader("companyId");
-        if (Validator.isNotEmpty(companyId)) {
-            add.setCompanyId(Long.valueOf(companyId));
-        }
+        add.setCompanyId(Long.valueOf(companyId));
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        TenantCovenantInfo tenantCovenantInfo = iTenantCovenantInfoService.getOne(new LambdaQueryWrapper<TenantCovenantInfo>().eq(TenantCovenantInfo::getStatus, 1));
-        add.setYiCompanyId(tenantCovenantInfo.getInfoId());
-        add.setYiCompanyContract(tenantCovenantInfo.getYiCompanyContract());
-        add.setYiCompanyAddress(tenantCovenantInfo.getYiCompanyAddress());
-        add.setYiCompanyPhone(tenantCovenantInfo.getYiCompanyPhone());
+        SysTenant yiSysTenant = iSysTenantService.getOne(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getTenantId, ServletUtils.getRequest().getHeader("TenantId")));
+        add.setYiCompanyContract(yiSysTenant.getLinkMan());
+        add.setYiCompanyPhone(yiSysTenant.getCompanyPh());
         int insert = this.baseMapper.insert(add);
         BsCovenant newBsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCovenantNum()).eq(BsCovenant::getStatus, 1));
         //写入协议审核流程
@@ -295,7 +225,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
             list.forEach(item -> {
                 BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
                 bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                bsCovenantCheckAddBo.setCompanyId(bo.getCompanyId());
+                bsCovenantCheckAddBo.setCompanyId(Long.valueOf(companyId));
                 List<String> list1 = Arrays.asList(item.split(","));
                 List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
                 longList.forEach(num -> {
@@ -304,10 +234,10 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                         bsCovenantCheckAddBo.setSort(4);
                     } else if (num == 2L) {
                         bsCovenantCheckAddBo.setSort(1);
+                        bsCovenantCheckAddBo.setCurrentStatus(1);
                     } else if (num == 3L) {
                         bsCovenantCheckAddBo.setSort(2);
                     } else if (num == 4L) {
-                        bsCovenantCheckAddBo.setCurrentStatus(1);
                         bsCovenantCheckAddBo.setSort(3);
                     }
                     bsCovenantCheckAddBo.setStatus(1);
@@ -333,27 +263,25 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                 } else if (bo.getCopyStatus() == 0) {
                     if (!bo.getBsCovenantBusinessList().isEmpty()) {
                         //写入协议业务类型
-                        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                            BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-                            covenantBusiness.setCovenantId(newBsCovenant.getCovenantId());
-                            covenantBusiness.setCompanyId(bo.getCompanyId());
-                            covenantBusiness.setCreateTime(DateUtils.getNowTime());
-                            covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-                            iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-                            if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessVo.getBusinessId())
-                                        .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessVo.getEducationTypeId())
-                                        .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessVo.getProjectId())
+                        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
+                            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                            bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+                            bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                            bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
+                            bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
+                            iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
+                            if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
+                                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
+                                        .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
+                                        .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
                                         .eq(BsCovenantBusiness::getStatus, 1));
                                 //写入协议业务类型有关商品
-                                bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                                    BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                                    covenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                                    covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                                    covenantGoodsAddBo.setCompanyId(bo.getCompanyId());
-                                    covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                                    covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                                    iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                                bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
+                                    bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                                    bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                                    bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                                    bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                                    iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
                                 });
                             }
                         });
@@ -362,28 +290,24 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
             }
             throw new CustomException("请选择是否复制协议数据");
         }
-        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-            BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-            covenantBusiness.setCovenantId(newBsCovenant.getCovenantId());
-            covenantBusiness.setCompanyId(bo.getCompanyId());
-            covenantBusiness.setCreateTime(DateUtils.getNowTime());
-            covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-            iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-            if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, covenantBusiness.getBusinessId())
-                        .eq(BsCovenantBusiness::getEducationTypeId, covenantBusiness.getEducationTypeId())
-                        .eq(BsCovenantBusiness::getProjectId, covenantBusiness.getProjectId())
-                                .eq(BsCovenantBusiness::getCovenantId,newBsCovenant.getCovenantId())
+        bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
+            CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+            bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+            bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
+            bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
+            iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
+            if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
+                BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
+                        .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
+                        .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
                         .eq(BsCovenantBusiness::getStatus, 1));
                 //写入协议业务类型有关商品
-                bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                    BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                    covenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
-                    covenantGoodsAddBo.setCompanyId(bo.getCompanyId());
-                    covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                    covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                    covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                    iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
+                    bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                    bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                    bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                    bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                    iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
                 });
             }
         });
@@ -396,24 +320,56 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
 
     @Override
     @Transactional
-    public Boolean updateByEditBo(BsCovenantEditBo bo) {
-        BsCovenant update = BeanUtil.toBean(bo, BsCovenant.class);
-        if (ObjectUtils.isNotNull(bo.getCovenantId())) {
-            update.setUpdateTime(DateUtils.getNowTime());
-            this.updateById(update);
-            //删除当前协议有关业务类型
-            List<BsCovenantBusiness> bsCovenantBusinessList = iBsCovenantBusinessService.list(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getCovenantId, bo.getCovenantId())
-                    .eq(BsCovenantBusiness::getStatus, 1));
-            if (!bsCovenantBusinessList.isEmpty()) {
-                List<Long> covenantBusinessIds = bsCovenantBusinessList.stream().map(BsCovenantBusiness::getCovenantBusinessId).collect(Collectors.toList());
-                iBsCovenantBusinessService.deleteWithValidByIds(covenantBusinessIds, true);
+    public Boolean insertYXTByAddBo(BsCovenantAddBo bo) {
+        if (bo.getCovenantId() != null) {
+            BsCovenantVo bsCovenantVo = this.queryById(bo.getCovenantId());
+            this.update(new LambdaUpdateWrapper<BsCovenant>().set(BsCovenant::getStatus, 7).eq(BsCovenant::getCovenantId, bsCovenantVo.getCovenantId()));
+            iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bsCovenantVo.getCovenantId()));
+            iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bsCovenantVo.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
+        } else {
+            BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
+            if (ObjectUtils.isNotNull(bo.getCompanyId())) {
+                Company byId = iCompanyService.getById(bo.getCompanyId());
+                add.setJiaCompanyAddress(byId.getCompanyAddress());
+                add.setJiaCompanyContract(byId.getCompanyContacts());
+                add.setJiaCompanyPhone(byId.getContactPhone());
+            }
+            String companyId = ServletUtils.getRequest().getHeader("companyId");
+            if (Validator.isNotEmpty(companyId)) {
+                add.setCompanyId(Long.valueOf(companyId));
             }
-            //删除当前协议相关商品信息
-            List<BsCovenantGoods> bsCovenantGoodsList = iBsCovenantGoodsService.list(new LambdaQueryWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bo.getCovenantId())
-                    .eq(BsCovenantGoods::getStatus, 1));
-            if (!bsCovenantGoodsList.isEmpty()) {
-                List<Long> covenantGoodsIds = bsCovenantGoodsList.stream().map(BsCovenantGoods::getCovenantGoodsId).collect(Collectors.toList());
-                iBsCovenantGoodsService.deleteWithValidByIds(covenantGoodsIds, true);
+            add.setCreateTime(DateUtils.getNowTime());
+            add.setUpdateTime(DateUtils.getNowTime());
+            this.baseMapper.insert(add);
+            BsCovenant newBsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCovenantNum()).eq(BsCovenant::getStatus, 1));
+            //写入协议审核流程
+            SysTenant sysTenant = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
+            if (ObjectUtils.isNotNull(sysTenant)) {
+                List<String> list = Arrays.asList(sysTenant.getAppList());
+                list.forEach(item -> {
+                    BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
+                    bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                    bsCovenantCheckAddBo.setCompanyId(bo.getCompanyId());
+                    List<String> list1 = Arrays.asList(item.split(","));
+                    List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
+                    longList.forEach(num -> {
+                        bsCovenantCheckAddBo.setAppId(num);
+                        if (num == 1L) {
+                            bsCovenantCheckAddBo.setSort(4);
+                        } else if (num == 2L) {
+                            bsCovenantCheckAddBo.setSort(1);
+                        } else if (num == 3L) {
+                            bsCovenantCheckAddBo.setSort(2);
+                        } else if (num == 4L) {
+                            bsCovenantCheckAddBo.setCurrentStatus(1);
+                            bsCovenantCheckAddBo.setSort(3);
+                        }
+                        bsCovenantCheckAddBo.setStatus(1);
+                        bsCovenantCheckAddBo.setCreateTime(DateUtils.getNowTime());
+                        bsCovenantCheckAddBo.setUpdateTime(DateUtils.getNowTime());
+                        iBsCovenantCheckService.insertByAddBo(bsCovenantCheckAddBo);
+                    });
+                });
             }
             if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
                 BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
@@ -431,25 +387,26 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                     } else if (bo.getCopyStatus() == 0) {
                         if (!bo.getBsCovenantBusinessList().isEmpty()) {
                             //写入协议业务类型
-                            bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                                BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-                                covenantBusiness.setCovenantId(bo.getCovenantId());
-                                covenantBusiness.setCreateTime(DateUtils.getNowTime());
-                                covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-                                iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-                                if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                                    BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessVo.getBusinessId())
-                                            .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessVo.getEducationTypeId())
-                                            .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessVo.getProjectId())
+                            bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
+                                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                                bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+                                bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
+                                bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
+                                bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
+                                iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
+                                if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
+                                    BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
+                                            .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
+                                            .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
                                             .eq(BsCovenantBusiness::getStatus, 1));
                                     //写入协议业务类型有关商品
-                                    bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                                        BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                                        covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
-                                        covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                                        covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                                        covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                                        iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                                    bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo-> {
+                                        bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                                        bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                                        bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
+                                        bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                                        bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                                        iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
                                     });
                                 }
                             });
@@ -458,30 +415,157 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
                 }
                 throw new CustomException("请选择是否复制协议数据");
             }
-            bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
-                BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
-                covenantBusiness.setCovenantId(bo.getCovenantId());
-                covenantBusiness.setCreateTime(DateUtils.getNowTime());
-                covenantBusiness.setUpdateTime(DateUtils.getNowTime());
-                iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
-                if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
-                    BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, covenantBusiness.getBusinessId())
-                            .eq(BsCovenantBusiness::getEducationTypeId, covenantBusiness.getEducationTypeId())
-                            .eq(BsCovenantBusiness::getProjectId, covenantBusiness.getProjectId())
+            bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
+                CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
+                bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
+                bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
+                bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
+                iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
+                if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
+                    BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
+                            .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
+                            .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
+                            .eq(BsCovenantBusiness::getCovenantId, newBsCovenant.getCovenantId())
                             .eq(BsCovenantBusiness::getStatus, 1));
                     //写入协议业务类型有关商品
-                    bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
-                        BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
-                        covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
-                        covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
-                        covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
-                        covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
-                        iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                    bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
+                        bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
+                        bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
+                        bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                        bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                        bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                        iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
                     });
                 }
             });
+        }
+        return true;
+    }
+
+    @Override
+    public Boolean insertYiInfo(TenantCovenantInfoAddBo bo) {
+        SysTenant tenantId = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
+        List<TenantCovenantInfoAddBo> tenantCovenantInfoAddBoList = new ArrayList<>();
+        if (ObjectUtils.isNotNull(tenantId.getDeliveryAddress())) {
+            String deliveryAddress = tenantId.getDeliveryAddress();
+            List<TenantCovenantInfoAddBo> tenantCovenantInfoAddBos = JSONArray.parseArray(deliveryAddress, TenantCovenantInfoAddBo.class);
+            tenantCovenantInfoAddBos.forEach(item -> {
+                if (item.getYiCompanyAddress().equals(bo.getYiCompanyAddress())) {
+                    item.setYiCompanyAddress(bo.getYiCompanyAddress());
+                }
+                tenantCovenantInfoAddBoList.add(item);
+            });
+            List<String> collect = tenantCovenantInfoAddBos.stream().map(TenantCovenantInfoAddBo::getYiCompanyAddress).collect(Collectors.toList());
+            if (!collect.contains(bo.getYiCompanyAddress())) {
+                if (bo.getStatus() == 1) {
+                    bo.setStatus(1L);
+                } else {
+                    bo.setStatus(0L);
+                }
+                tenantCovenantInfoAddBoList.add(bo);
+            }
+        }
+        tenantId.setDeliveryAddress(JSON.toJSONString(tenantCovenantInfoAddBoList));
+        return iSysTenantService.updateById(tenantId);
+
+    }
+
+    @Override
+    @Transactional
+    public Boolean updateByEditBo(BsCovenantEditBo bo) {
+        if (bo.getCovenantId() == null) {
+            throw new CustomException("请选择协议");
         } else {
-            throw new CustomException("未选择");
+            BsCovenantVo bsCovenantVo = queryById(bo.getCovenantId());
+            if (bsCovenantVo.getStatus() != 4) {
+                throw new CustomException("当前协议未处于审核不通过状态");
+            } else {
+                BsCovenant update = BeanUtil.toBean(bo, BsCovenant.class);
+                update.setUpdateTime(DateUtils.getNowTime());
+                this.updateById(update);
+                //删除当前协议有关业务类型
+                List<BsCovenantBusiness> bsCovenantBusinessList = iBsCovenantBusinessService.list(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getCovenantId, bo.getCovenantId())
+                        .eq(BsCovenantBusiness::getStatus, 1));
+                if (!bsCovenantBusinessList.isEmpty()) {
+                    List<Long> covenantBusinessIds = bsCovenantBusinessList.stream().map(BsCovenantBusiness::getCovenantBusinessId).collect(Collectors.toList());
+                    iBsCovenantBusinessService.deleteWithValidByIds(covenantBusinessIds, true);
+                }
+                //删除当前协议相关商品信息
+                List<BsCovenantGoods> bsCovenantGoodsList = iBsCovenantGoodsService.list(new LambdaQueryWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bo.getCovenantId())
+                        .eq(BsCovenantGoods::getStatus, 1));
+                if (!bsCovenantGoodsList.isEmpty()) {
+                    List<Long> covenantGoodsIds = bsCovenantGoodsList.stream().map(BsCovenantGoods::getCovenantGoodsId).collect(Collectors.toList());
+                    iBsCovenantGoodsService.deleteWithValidByIds(covenantGoodsIds, true);
+                }
+                if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
+                    BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
+                    if (ObjectUtils.isNotNull(bo.getCopyStatus())) {
+                        if (bo.getCopyStatus() == 1) {
+                            //复制协议时删除复制协议相关信息
+                            if (ObjectUtils.isNotNull(bs)) {
+                                bs.setStatus(0);
+                                this.updateById(bs);
+                                iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bs.getCovenantId()));
+                                iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bs.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
+                            } else {
+                                throw new CustomException("当前协议不存在");
+                            }
+                        } else if (bo.getCopyStatus() == 0) {
+                            if (!bo.getBsCovenantBusinessList().isEmpty()) {
+                                //写入协议业务类型
+                                bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
+                                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessVo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                                    BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
+                                    covenantBusiness.setBusinessId(courseBusiness.getId());
+                                    covenantBusiness.setCreateTime(DateUtils.getNowTime());
+                                    covenantBusiness.setUpdateTime(DateUtils.getNowTime());
+                                    iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
+                                    if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
+                                        BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessVo.getBusinessId())
+                                                .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessVo.getEducationTypeId())
+                                                .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessVo.getProjectId())
+                                                .eq(BsCovenantBusiness::getStatus, 1));
+                                        //写入协议业务类型有关商品
+                                        bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
+                                            BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
+                                            covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
+                                            covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                                            covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                                            covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                                            iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                                        });
+                                    }
+                                });
+                            }
+                        }
+                    }
+                    throw new CustomException("请选择是否复制协议数据");
+                }
+                bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
+                    CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getProjectId, bsCovenantBusinessVo.getProjectId()).eq(CourseBusiness::getStatus, 1));
+                    BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
+                    covenantBusiness.setBusinessId(courseBusiness.getId());
+                    covenantBusiness.setCreateTime(DateUtils.getNowTime());
+                    covenantBusiness.setUpdateTime(DateUtils.getNowTime());
+                    iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
+                    if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
+                        BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, covenantBusiness.getBusinessId())
+                                .eq(BsCovenantBusiness::getEducationTypeId, covenantBusiness.getEducationTypeId())
+                                .eq(BsCovenantBusiness::getProjectId, covenantBusiness.getProjectId())
+                                .eq(BsCovenantBusiness::getStatus, 1));
+                        //写入协议业务类型有关商品
+                        bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
+                            BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
+                            covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
+                            covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
+                            covenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
+                            covenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
+                            iBsCovenantGoodsService.insertByAddBo(covenantGoodsAddBo);
+                        });
+                    }
+                });
+            }
         }
         return true;
     }
@@ -520,19 +604,10 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
     }
 
     @Override
-    public String getCovenantNum(Long businessId, Long projectId) {
-        BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, businessId)
-                .eq(BsCovenantBusiness::getProjectId, projectId).eq(BsCovenantBusiness::getStatus, 1));
-        if (ObjectUtils.isNotNull(bsCovenantBusiness)) {
-            Long covenantId = bsCovenantBusiness.getCovenantId();
-            BsCovenant byId = this.getById(covenantId);
-            if (ObjectUtils.isNotNull(byId)) {
-                return byId.getCovenantNum();
-            } else {
-                throw new CustomException("当前协议不存在协议编号");
-            }
-        }
-        return null;
+    public String getJudgeBusiness(Long businessId,Long userId) {
+        CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, businessId).eq(CourseBusiness::getStatus, 1));
+        return iBsCovenantBusinessService.getCovenantNumByProjectId(Long.valueOf(courseBusiness.getProjectId()), userId, courseBusiness.getId());
+
     }
 
     @Override
@@ -545,11 +620,10 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
         TenantAccountBo sysTenantAccountVo = new TenantAccountBo();
         if (!listSysTenant.isEmpty()) {
             SysTenant sysTenant = listSysTenant.get(0);
-            String replace = sysTenant.getAccountInformation().replace("[", "").replace("]", "");
-            JSONObject jsonObject = JSON.parseObject(replace);
-            sysTenantAccountVo.setOpeningBank(jsonObject.getString("openingBank"));
-            sysTenantAccountVo.setProceedsAccount(jsonObject.getString("proceedsAccount"));
-            sysTenantAccountVo.setOpeningName(jsonObject.getString("openingName"));
+            List<TenantAccountBo> tenantAccountBos = JSONArray.parseArray(sysTenant.getAccountInformation(), TenantAccountBo.class);
+            if (!tenantAccountBos.isEmpty()) {
+                sysTenantAccountVo = tenantAccountBos.get(0);
+            }
         }
         BsCovenantExportVo bean = BeanUtil.toBean(bsCovenantVo, BsCovenantExportVo.class);
         String zhiyuan = System.getProperty("user.dir");
@@ -621,7 +695,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
     }
 
     @Override
-    public boolean updateCheckStatus(NoCheckInfo noCheckInfo,Long userId) {
+    public boolean updateCheckStatus(NoCheckInfo noCheckInfo, Long userId) {
         List<SysMenu> listSysMenuByTenant = iSysMenuService.selectMenuList(userId);
         List<String> menuNameList = listSysMenuByTenant.stream().map(SysMenu::getMenuName).collect(Collectors.toList());
         //判断当前用户是否存在改路由
@@ -653,7 +727,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
     }
 
     @Override
-    public boolean updateStopCheck(NoCheckInfo noCheckInfo,Long userId) {
+    public boolean updateStopCheck(NoCheckInfo noCheckInfo, Long userId) {
         List<SysMenu> listSysMenuByTenant = iSysMenuService.selectMenuList(userId);
         List<String> menuNameList = listSysMenuByTenant.stream().map(SysMenu::getMenuName).collect(Collectors.toList());
         if (menuNameList.contains("协议审核")) {
@@ -664,7 +738,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
             if (bsCovenantVo.getStopStatus() != 1) {
                 throw new CustomException("当前协议未处于终止待审核状态");
             }
-            if (noCheckInfo.getStatus()==3){
+            if (noCheckInfo.getStatus() == 3) {
                 CovenantCheckRecordAddBo covenantCheckRecord = new CovenantCheckRecordAddBo();
                 covenantCheckRecord.setCovenantId(noCheckInfo.getCovenantId());
                 covenantCheckRecord.setUserId(userId);
@@ -688,15 +762,15 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
         if (ObjectUtils.isNull(bsCovenantVo)) {
             throw new CustomException("当前协议不存在");
         }
-        if (bsCovenantVo.getStatus()!=2){
+        if (bsCovenantVo.getStatus() != 2) {
             throw new CustomException("当前协议未审核通过");
         }
-        if(ObjectUtils.isNull(paths)){
-            throw new CustomException("上传协议");
+        if (ObjectUtils.isNull(paths)) {
+            throw new CustomException("上传协议");
         }
         BsCovenant bsCovenant = BeanUtil.toBean(bsCovenantVo, BsCovenant.class);
         bsCovenant.setUploadStatus(1);
-        bsCovenant.setCovenantImg(paths.toString());
+        bsCovenant.setCovenantImg(JSON.toJSONString(paths));
         bsCovenant.setUpdateTime(DateUtils.getNowTime());
         return updateById(bsCovenant);
     }
@@ -707,7 +781,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
         if (ObjectUtils.isNull(bsCovenantVo)) {
             throw new CustomException("当前协议不存在");
         }
-        if (bsCovenantVo.getUploadStatus()!=1){
+        if (bsCovenantVo.getUploadStatus() != 1) {
             throw new CustomException("当前协议未上传");
         }
         BsCovenant bean = BeanUtil.toBean(bsCovenantVo, BsCovenant.class);
@@ -718,19 +792,23 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
     }
 
     @Override
-    public Integer countNoCheckNum() {
-        return this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getStatus, 1).eq(BsCovenant::getStopStatus, 0));
+    public Integer countNoCheckNum(Long userId, Long formApp) {
+        return this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getStatus, 1).eq(BsCovenant::getStopStatus, 0)
+                .eq(BsCovenant::getUserId, userId).eq(BsCovenant::getFormApp, formApp));
     }
 
     @Override
-    public Integer countStopNoCheckNum() {
-        return this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getStopStatus, 1).eq(BsCovenant::getStatus,5));
+    public Integer countStopNoCheckNum(Long userId, Long formApp) {
+        return this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getStopStatus, 1).eq(BsCovenant::getStatus, 5)
+                .eq(BsCovenant::getUserId, userId).eq(BsCovenant::getFormApp, formApp));
     }
 
     @Override
-    public Map<String, Object> countUploadImgNum() {
-        Integer noUpload = this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getUploadStatus, 0).eq(BsCovenant::getStatus, 2));
-        Integer noAssert = this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getUploadStatus, 1).eq(BsCovenant::getStatus, 2));
+    public Map<String, Object> countUploadImgNum(Long userId, Long formApp) {
+        Integer noUpload = this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getUploadStatus, 0).eq(BsCovenant::getStatus, 2)
+                .eq(BsCovenant::getStopStatus, 0).eq(BsCovenant::getUserId, userId).eq(BsCovenant::getFormApp, formApp));
+        Integer noAssert = this.baseMapper.selectCount(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getUploadStatus, 1).eq(BsCovenant::getStatus, 2)
+                .eq(BsCovenant::getStopStatus, 0).eq(BsCovenant::getUserId, userId).eq(BsCovenant::getFormApp, formApp));
         HashMap<String, Object> stringObjectHashMap = new HashMap<>();
         stringObjectHashMap.put("noUpload", noUpload);
         stringObjectHashMap.put("noAssert", noAssert);

+ 0 - 124
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/service/impl/TenantCovenantInfoServiceImpl.java

@@ -1,124 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.service.impl;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zhongzheng.common.exception.CustomException;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoEditBo;
-import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoQueryBo;
-import com.zhongzheng.modules.bs.covenant.domain.TenantCovenantInfo;
-import com.zhongzheng.modules.bs.covenant.mapper.TenantCovenantInfoMapper;
-import com.zhongzheng.modules.bs.covenant.service.ITenantCovenantInfoService;
-import com.zhongzheng.modules.bs.covenant.vo.TenantCovenantInfoVo;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.github.pagehelper.Page;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.StringUtils;
-
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 乙方协议收件信息Service业务层处理
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-@Service
-public class TenantCovenantInfoServiceImpl extends ServiceImpl<TenantCovenantInfoMapper, TenantCovenantInfo> implements ITenantCovenantInfoService {
-
-    @Override
-    public TenantCovenantInfoVo queryById(Long infoId){
-        TenantCovenantInfo db = this.baseMapper.selectById(infoId);
-        return BeanUtil.toBean(db, TenantCovenantInfoVo.class);
-    }
-
-    @Override
-    public List<TenantCovenantInfoVo> queryList(TenantCovenantInfoQueryBo bo) {
-        LambdaQueryWrapper<TenantCovenantInfo> lqw = Wrappers.lambdaQuery();
-        lqw.eq(StrUtil.isNotBlank(bo.getYiCompanyName()), TenantCovenantInfo::getYiCompanyName, bo.getYiCompanyName());
-        lqw.eq(StrUtil.isNotBlank(bo.getYiCompanyAddress()), TenantCovenantInfo::getYiCompanyAddress, bo.getYiCompanyAddress());
-        lqw.eq(StrUtil.isNotBlank(bo.getYiCompanyPhone()), TenantCovenantInfo::getYiCompanyPhone, bo.getYiCompanyPhone());
-        lqw.eq(StrUtil.isNotBlank(bo.getYiCompanyContract()), TenantCovenantInfo::getYiCompanyContract, bo.getYiCompanyContract());
-        lqw.eq(bo.getStatus() != null, TenantCovenantInfo::getStatus, bo.getStatus());
-        return entity2Vo(this.list(lqw));
-    }
-
-    /**
-    * 实体类转化成视图对象
-    *
-    * @param collection 实体类集合
-    * @return
-    */
-    private List<TenantCovenantInfoVo> entity2Vo(Collection<TenantCovenantInfo> collection) {
-        List<TenantCovenantInfoVo> voList = collection.stream()
-                .map(any -> BeanUtil.toBean(any, TenantCovenantInfoVo.class))
-                .collect(Collectors.toList());
-        if (collection instanceof Page) {
-            Page<TenantCovenantInfo> page = (Page<TenantCovenantInfo>)collection;
-            Page<TenantCovenantInfoVo> pageVo = new Page<>();
-            BeanUtil.copyProperties(page,pageVo);
-            pageVo.addAll(voList);
-            voList = pageVo;
-        }
-        return voList;
-    }
-
-    @Override
-    @Transactional
-    public Boolean insertByAddBo(TenantCovenantInfoAddBo bo) {
-        if (ObjectUtil.isAllEmpty(bo.getYiCompanyName(),bo.getYiCompanyAddress(),bo.getStatus())){
-            throw new CustomException("信息不能为空");
-        }
-        TenantCovenantInfo add = BeanUtil.toBean(bo, TenantCovenantInfo.class);
-        if (ObjectUtils.isNotNull(bo.getYiCompanyName())){
-            TenantCovenantInfo tenantCovenantInfo = this.getOne(new LambdaQueryWrapper<TenantCovenantInfo>().eq(TenantCovenantInfo::getYiCompanyName, bo.getYiCompanyName()).eq(TenantCovenantInfo::getStatus, 1));
-            if (ObjectUtils.isNotNull(tenantCovenantInfo)){
-                add.setInfoId(tenantCovenantInfo.getInfoId());
-                add.setUpdateTime(DateUtils.getNowTime());
-                this.updateById(add);
-            }else {
-                add.setCreateTime(DateUtils.getNowTime());
-                add.setUpdateTime(DateUtils.getNowTime());
-                this.baseMapper.insert(add);
-            }
-        }else {
-            throw new CustomException("乙方名称不能为空");
-        }
-       return true;
-    }
-
-    @Override
-    public Boolean updateByEditBo(TenantCovenantInfoEditBo bo) {
-        TenantCovenantInfo update = BeanUtil.toBean(bo, TenantCovenantInfo.class);
-        validEntityBeforeSave(update);
-        update.setUpdateTime(DateUtils.getNowTime());
-        return this.updateById(update);
-    }
-
-    /**
-     * 保存前的数据校验
-     *
-     * @param entity 实体类数据
-     */
-    private void validEntityBeforeSave(TenantCovenantInfo entity){
-        //TODO 做一些数据校验,如唯一约束
-    }
-
-    @Override
-    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
-            //TODO 做一些业务上的校验,判断是否需要校验
-        }
-        return this.removeByIds(ids);
-    }
-}

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

@@ -32,8 +32,8 @@ public class BsCovenantVo {
 	@ApiModelProperty("协议编号")
 	private String covenantNum;
 	/** 申请时间 */
-	@Excel(name = "申请时间")
-	@ApiModelProperty("申请时间")
+	@Excel(name = "开始时间")
+	@ApiModelProperty("开始时间")
 	private Long applyTime;
 	/** 结束时间 */
 	@Excel(name = "结束时间")
@@ -116,10 +116,6 @@ public class BsCovenantVo {
 	@Excel(name = "甲方收件备注")
 	@ApiModelProperty("甲方收件备注")
 	private String jiaRecipientsRemark;
-	/** 乙方企业id */
-	@Excel(name = "乙方企业id")
-	@ApiModelProperty("乙方企业id")
-	private Long yiCompanyId;
 	/** 乙方企业名称 */
 	@Excel(name = "乙方企业名称")
 	@ApiModelProperty("乙方企业名称")
@@ -128,10 +124,6 @@ public class BsCovenantVo {
 	@Excel(name = "乙方企业联系人")
 	@ApiModelProperty("乙方企业联系人")
 	private String yiCompanyContract;
-	/** 乙方企业地址 */
-	@Excel(name = "乙方企业地址")
-	@ApiModelProperty("乙方企业地址")
-	private String yiCompanyAddress;
 	/** 乙方电话 */
 	@Excel(name = "乙方电话")
 	@ApiModelProperty("乙方电话")

+ 0 - 42
zhongzheng-system/src/main/java/com/zhongzheng/modules/bs/covenant/vo/TenantCovenantInfoVo.java

@@ -1,42 +0,0 @@
-package com.zhongzheng.modules.bs.covenant.vo;
-
-import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import java.util.Date;
-
-
-
-/**
- * 乙方信息视图对象 mall_package
- *
- * @author ruoyi
- * @date 2024-05-30
- */
-@Data
-@ApiModel("乙方信息视图对象")
-public class TenantCovenantInfoVo {
-	private static final long serialVersionUID = 1L;
-
-	/** $pkColumn.columnComment */
-	@ApiModelProperty("$pkColumn.columnComment")
-	private Long infoId;
-
-	/** 乙方公司名称 */
-	@ApiModelProperty("乙方公司名称")
-	private String yiCompanyName;
-	/** 乙方公司地址 */
-	@ApiModelProperty("乙方公司地址")
-	private String yiCompanyAddress;
-	/** 乙方联系人 */
-	@ApiModelProperty("乙方联系人")
-	private String yiCompanyContract;
-	/** 乙方联系电话 */
-	@ApiModelProperty("乙方联系电话")
-	private String yiCompanyPhone;
-	/** 状态 1有效 0无效 */
-	@ApiModelProperty("状态 1有效 0无效")
-	private Long status;
-}

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantAddBo.java

@@ -117,5 +117,6 @@ public class SysTenantAddBo {
     private String hostAdmin;
     @ApiModelProperty("开通应用列表 1云学堂  2企业系统  3业务系统 4总平台")
     private String appList;
-
+    @ApiModelProperty("乙方收件地址")
+    private String deliveryAddress;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantEditBo.java

@@ -116,4 +116,6 @@ public class SysTenantEditBo {
     private String handleBank;
     @ApiModelProperty("开通应用列表 1云学堂  2企业系统  3业务系统 4总平台")
     private String appList;
+    @ApiModelProperty("乙方收件地址")
+    private String deliveryAddress;
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/bo/SysTenantQueryBo.java

@@ -125,5 +125,6 @@ public class SysTenantQueryBo extends BaseEntity {
 	private String hostAdmin;
 	@ApiModelProperty("开通应用列表 1云学堂  2企业系统  3业务系统 4总平台")
 	private String appList;
-
+	@ApiModelProperty("乙方收件地址")
+	private String deliveryAddress;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java

@@ -119,4 +119,5 @@ private static final long serialVersionUID=1L;
     /** 经办订单对公收款账户 */
     private String handleBank;
     private String appList;
+    private String deliveryAddress;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/vo/SysTenantVo.java

@@ -69,4 +69,6 @@ public class SysTenantVo {
 	private String eduPhone;
 	@ApiModelProperty("开通应用列表 1云学堂  2企业系统  3业务系统 4总平台")
 	private String appList;
+	@ApiModelProperty("乙方收件地址")
+	private String deliveryAddress;
 }

+ 15 - 1
zhongzheng-system/src/main/resources/mapper/modules/covenant/BsCovenantBusinessMapper.xml

@@ -17,5 +17,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
-
+<select id="getCovenantNumByProjectId" parameterType="Long"  resultType="String">
+    select bc.covenant_num
+    from bs_covenant_business bcb
+             left join bs_covenant bc on bcb.covenant_id = bc.covenant_id
+    where bc.status = 5 and bcb.status=1
+    <if test="projectId!=null and projectId!=''">
+        and  bcb.project_id=#{projectId}
+    </if>
+    <if test="businessId!=null and businessId!=''">
+        and  bcb.business_id=#{businessId}
+    </if>
+    <if test="userId!=null and userId!=''">
+        and  bc.user_id=#{userId}
+    </if>
+</select>
 </mapper>

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

@@ -27,9 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="jiaRecipientsAddress" column="jia_recipients_address"/>
         <result property="jiaRecipientsPhone" column="jia_recipients_phone"/>
         <result property="jiaRecipientsRemark" column="jia_recipients_remark"/>
-        <result property="yiCompanyId" column="yi_company_id"/>
         <result property="yiCompanyContract" column="yi_company_contract"/>
-        <result property="yiCompanyAddress" column="yi_company_address"/>
         <result property="yiCompanyPhone" column="yi_company_phone"/>
         <result property="yiRecipients" column="yi_recipients"/>
         <result property="yiRecipientsAddress" column="yi_recipients_address"/>
@@ -62,10 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="jiaRecipientsAddress" column="jia_recipients_address"/>
         <result property="jiaRecipientsPhone" column="jia_recipients_phone"/>
         <result property="jiaRecipientsRemark" column="jia_recipients_remark"/>
-        <result property="yiCompanyId" column="yi_company_id"/>
         <result property="yiCompanyName" column="yi_company_name"/>
         <result property="yiCompanyContract" column="yi_company_contract"/>
-        <result property="yiCompanyAddress" column="yi_company_address"/>
         <result property="yiCompanyPhone" column="yi_company_phone"/>
         <result property="yiRecipients" column="yi_recipients"/>
         <result property="yiRecipientsAddress" column="yi_recipients_address"/>
@@ -94,6 +90,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <if test="listType ==5">
         and bc.upload_status!=6
     </if>
+    <if test="userId != null and userId != ''">
+        and bc.user_id=#{userId}
+    </if>
+    <if test="formApp != null and formApp != ''">
+        and bc.form_app=#{formApp}
+    </if>
     <if test="covenantNum != null and covenantNum != ''">
         and bc.covenant_num=#{covenantNum}
     </if>
@@ -106,12 +108,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <if test="uploadStatus != null">
         and bc.upload_status =#{uploadStatus} and bc.status=2
     </if>
-    <if test="userId !=null">
-        bc.user_id=#{userId}
-    </if>
-    <if test="formApp !=null">
-        bc.form_app=#{formApp}
-    </if>
     order by bc.create_time desc
 </select>
 </mapper>

+ 0 - 19
zhongzheng-system/src/main/resources/mapper/modules/covenant/TenantCovenantInfoMapper.xml

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zhongzheng.modules.bs.covenant.mapper.TenantCovenantInfoMapper">
-
-    <resultMap type="com.zhongzheng.modules.bs.covenant.domain.TenantCovenantInfo" id="TenantCovenantInfoResult">
-        <result property="infoId" column="info_id"/>
-        <result property="yiCompanyName" column="yi_company_name"/>
-        <result property="yiCompanyAddress" column="yi_company_address"/>
-        <result property="yiCompanyContract" column="yi_company_contract"/>
-        <result property="yiCompanyPhone" column="yi_company_phone"/>
-        <result property="status" column="status"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateTime" column="update_time"/>
-    </resultMap>
-
-
-</mapper>

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/system/SysTenantMapper.xml

@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="city" column="city"/>
         <result property="district" column="district"/>
         <result property="address" column="address"/>
+        <result property="deliveryAddress" column="delivery_address"/>
         <result property="companyPh" column="company_ph"/>
         <result property="linkMan" column="link_man"/>
         <result property="postBox" column="post_box"/>