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.domain.model.LoginUser; import com.zhongzheng.common.core.page.TableDataInfo; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.common.utils.poi.ExcelUtil; 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; import com.zhongzheng.modules.records.vo.CovenantCheckRecordVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** * 企业协议Controller * * @author ruoyi * @date 2024-05-28 */ @Api(value = "企业协议控制器", tags = {"企业协议管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/bs/covenant") public class BsCovenantController extends BaseController { private final IBsCovenantService iBsCovenantService; private final TokenService tokenService; /** * 查询企业协议列表 */ @ApiOperation("查询企业协议管理列表") @GetMapping("/getCovenantList") public TableDataInfo getCovenantList(BsCovenantQueryBo bo) { startPage(); bo.setListType(1); bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId()); bo.setFormApp(1L); List list = iBsCovenantService.queryList(bo); return getDataTable(list); } /** * 查询企业协议列表 */ @ApiOperation("查询终止管理协议列表") @GetMapping("/getStopCovenantList") public TableDataInfo getStopCovenantList(BsCovenantQueryBo bo) { startPage(); bo.setListType(2); bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId()); bo.setFormApp(1L); List list = iBsCovenantService.queryList(bo); return getDataTable(list); } /** * 查询企业协议列表 */ @ApiOperation("查询协议审核列表") @GetMapping("/getCovenantCheckList") public TableDataInfo getCovenantCheckList(BsCovenantQueryBo bo) { startPage(); bo.setListType(3); bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId()); bo.setFormApp(1L); List list = iBsCovenantService.queryList(bo); return getDataTable(list); } /** * 查询企业协议列表 */ @ApiOperation("查询终止审核列表") @GetMapping("/getStopCheckList") public TableDataInfo getStopCheckList(BsCovenantQueryBo bo) { startPage(); bo.setListType(4); bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId()); bo.setFormApp(1L); List list = iBsCovenantService.queryList(bo); return getDataTable(list); } /** * 查询企业协议列表 */ @ApiOperation("查询协议上传列表") @GetMapping("/getCovenantUploadList") public TableDataInfo getCovenantUploadList(BsCovenantQueryBo bo) { startPage(); bo.setListType(5); bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId()); bo.setFormApp(1L); List list = iBsCovenantService.queryList(bo); 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 getInfo(@PathVariable("covenantId") Long covenantId) { return AjaxResult.success(iBsCovenantService.queryById(covenantId)); } /** * 新增企业协议 */ @ApiOperation("云学堂新增协议") @Log(title = "企业协议", businessType = BusinessType.INSERT) @PostMapping("/insert") public AjaxResult add(@RequestBody BsCovenantAddBo bo) { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); bo.setUserId(loginUser.getUser().getUserId()); bo.setFormApp(1L); return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0); } @ApiOperation("云学堂新增乙方地址信息") @Log(title = "企业协议", businessType = BusinessType.INSERT) @PostMapping("/insertYiInfo") public AjaxResult insertYiInfo(@RequestBody TenantCovenantInfoAddBo bo) { return toAjax(iBsCovenantService.insertYiInfo(bo) ? 1 : 0); } /** * 新增企业协议 */ @ApiOperation("业务系统新增协议") @Log(title = "企业协议", businessType = BusinessType.INSERT) @PostMapping("/insertYw") public AjaxResult addYW(@RequestBody BsCovenantAddBo bo) { bo.setFormApp(3L); return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0); } /** * 修改企业协议 */ @ApiOperation("复制新增") @Log(title = "企业协议", businessType = BusinessType.UPDATE) @PostMapping("/copyAndInsert") public AjaxResult copyAndInsert(@RequestBody BsCovenantAddBo bo) { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); bo.setUserId(loginUser.getUser().getUserId()); bo.setFormApp(1L); return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0); } /** * 修改企业协议 */ @ApiOperation("修改重提") @Log(title = "企业协议", businessType = BusinessType.UPDATE) @PostMapping("/updateCommit") public AjaxResult copyAndInsert(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.updateByEditBo(bo) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("协议取消") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/cancelStatus") public AjaxResult cancelStatus(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.deleteWithValidByIds(bo.getCovenantId()) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("生成协议编号") @Log(title = "企业协议", businessType = BusinessType.DELETE) @GetMapping("/getCovenantNum") public AjaxResult getCovenantNum() { return AjaxResult.success(iBsCovenantService.getCovenantNum()); } /** * 删除企业协议 */ @ApiOperation("判断当前业务类型是否有已知存在协议") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/judgeBusiness") 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) @PostMapping("/updateStopStatus") public AjaxResult updateStopStatus(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.updateStopStatus(bo.getCovenantId()) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("取消终止申请") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/cancelStopStatus") public AjaxResult cancelStopStatus(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.cancelStopStatus(bo.getCovenantId()) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("协议审核") @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); } /** * 删除企业协议 */ @ApiOperation("终止审核") @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); } /** * 删除企业协议 */ @ApiOperation("协议上传") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/uploadImg") public AjaxResult uploadImg(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.uploadImg(bo.getCovenantId(), bo.getPaths()) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("协议上传确认生效") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/confirmAssert") public AjaxResult confirmAssert(@RequestBody BsCovenantEditBo bo) { return toAjax(iBsCovenantService.confirmAssert(bo.getCovenantId()) ? 1 : 0); } /** * 删除企业协议 */ @ApiOperation("统计协议审核待审核数量") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/countNoCheckNum") public AjaxResult countNoCheckNum() { Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId(); return AjaxResult.success(iBsCovenantService.countNoCheckNum(userId, 1L)); } /** * 删除企业协议 */ @ApiOperation("统计终止审核待审核数量") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/countStopNoCheckNum") public AjaxResult countStopNoCheckNum() { Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId(); return AjaxResult.success(iBsCovenantService.countStopNoCheckNum(userId, 1L)); } @ApiOperation("统计协议上传数量") @Log(title = "企业协议", businessType = BusinessType.DELETE) @PostMapping("/countUploadImgNum") public AjaxResult countUploadImgNum() { Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId(); return AjaxResult.success(iBsCovenantService.countUploadImgNum(userId, 1L)); } @ApiOperation("获取审核意见列表") @Log(title = "企业协议", businessType = BusinessType.DELETE) @GetMapping("/getCheckInfo") public TableDataInfo getCheckInfo(@RequestParam("covenantId") Long covenantId) { return getDataTable(iBsCovenantService.getNoCheckInfo(covenantId)); } }