BsCovenantController.java 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. package com.zhongzheng.controller.covenant;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.domain.model.LoginUser;
  6. import com.zhongzheng.common.core.page.TableDataInfo;
  7. import com.zhongzheng.common.enums.BusinessType;
  8. import com.zhongzheng.common.utils.ServletUtils;
  9. import com.zhongzheng.common.utils.poi.ExcelUtil;
  10. import com.zhongzheng.framework.web.service.TokenService;
  11. import com.zhongzheng.modules.bs.covenant.bo.BsCovenantAddBo;
  12. import com.zhongzheng.modules.bs.covenant.bo.BsCovenantEditBo;
  13. import com.zhongzheng.modules.bs.covenant.bo.BsCovenantQueryBo;
  14. import com.zhongzheng.modules.bs.covenant.bo.TenantCovenantInfoAddBo;
  15. import com.zhongzheng.modules.bs.covenant.service.IBsCovenantService;
  16. import com.zhongzheng.modules.bs.covenant.vo.BsCovenantVo;
  17. import com.zhongzheng.modules.bs.covenant.vo.NoCheckInfo;
  18. import com.zhongzheng.modules.records.vo.CovenantCheckRecordVo;
  19. import io.swagger.annotations.Api;
  20. import io.swagger.annotations.ApiOperation;
  21. import lombok.RequiredArgsConstructor;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.web.bind.annotation.*;
  24. import java.util.Arrays;
  25. import java.util.List;
  26. /**
  27. * 企业协议Controller
  28. *
  29. * @author ruoyi
  30. * @date 2024-05-28
  31. */
  32. @Api(value = "企业协议控制器", tags = {"企业协议管理"})
  33. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  34. @RestController
  35. @RequestMapping("/bs/covenant")
  36. public class BsCovenantController extends BaseController {
  37. private final IBsCovenantService iBsCovenantService;
  38. private final TokenService tokenService;
  39. /**
  40. * 查询企业协议列表
  41. */
  42. @ApiOperation("查询企业协议管理列表")
  43. @GetMapping("/getCovenantList")
  44. public TableDataInfo<BsCovenantVo> getCovenantList(BsCovenantQueryBo bo) {
  45. startPage();
  46. bo.setListType(1);
  47. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  48. bo.setFormApp(1L);
  49. List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
  50. return getDataTable(list);
  51. }
  52. /**
  53. * 查询企业协议列表
  54. */
  55. @ApiOperation("查询终止管理协议列表")
  56. @GetMapping("/getStopCovenantList")
  57. public TableDataInfo<BsCovenantVo> getStopCovenantList(BsCovenantQueryBo bo) {
  58. startPage();
  59. bo.setListType(2);
  60. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  61. bo.setFormApp(1L);
  62. List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
  63. return getDataTable(list);
  64. }
  65. /**
  66. * 查询企业协议列表
  67. */
  68. @ApiOperation("查询协议审核列表")
  69. @GetMapping("/getCovenantCheckList")
  70. public TableDataInfo<BsCovenantVo> getCovenantCheckList(BsCovenantQueryBo bo) {
  71. startPage();
  72. bo.setListType(3);
  73. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  74. bo.setFormApp(1L);
  75. List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
  76. return getDataTable(list);
  77. }
  78. /**
  79. * 查询企业协议列表
  80. */
  81. @ApiOperation("查询终止审核列表")
  82. @GetMapping("/getStopCheckList")
  83. public TableDataInfo<BsCovenantVo> getStopCheckList(BsCovenantQueryBo bo) {
  84. startPage();
  85. bo.setListType(4);
  86. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  87. bo.setFormApp(1L);
  88. List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
  89. return getDataTable(list);
  90. }
  91. /**
  92. * 查询企业协议列表
  93. */
  94. @ApiOperation("查询协议上传列表")
  95. @GetMapping("/getCovenantUploadList")
  96. public TableDataInfo<BsCovenantVo> getCovenantUploadList(BsCovenantQueryBo bo) {
  97. startPage();
  98. bo.setListType(5);
  99. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  100. bo.setFormApp(1L);
  101. List<BsCovenantVo> list = iBsCovenantService.queryList(bo);
  102. return getDataTable(list);
  103. }
  104. /**
  105. * 查询企业协议列表
  106. */
  107. @ApiOperation("查询甲乙方上一次收件信息")
  108. @GetMapping("/getLastJiaInfo")
  109. public AjaxResult getLastJiaInfo(BsCovenantQueryBo bo) {
  110. startPage();
  111. bo.setUserId(tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId());
  112. bo.setFormApp(1L);
  113. return AjaxResult.success(iBsCovenantService.getLastJiaInfo(bo));
  114. }
  115. /**
  116. * 查询企业协议列表
  117. */
  118. @ApiOperation("查询乙方名称及地址")
  119. @GetMapping("/getYiInfo")
  120. public AjaxResult getYiInfo() {
  121. return AjaxResult.success(iBsCovenantService.getYiInfo());
  122. }
  123. /**
  124. * 获取企业协议详细信息
  125. */
  126. @ApiOperation("获取企业协议详细信息")
  127. @GetMapping("/{covenantId}")
  128. public AjaxResult<BsCovenantVo> getInfo(@PathVariable("covenantId") Long covenantId) {
  129. return AjaxResult.success(iBsCovenantService.queryById(covenantId));
  130. }
  131. /**
  132. * 新增企业协议
  133. */
  134. @ApiOperation("云学堂新增协议")
  135. @Log(title = "企业协议", businessType = BusinessType.INSERT)
  136. @PostMapping("/insert")
  137. public AjaxResult<Void> add(@RequestBody BsCovenantAddBo bo) {
  138. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  139. bo.setUserId(loginUser.getUser().getUserId());
  140. bo.setFormApp(1L);
  141. return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0);
  142. }
  143. @ApiOperation("云学堂新增乙方地址信息")
  144. @Log(title = "企业协议", businessType = BusinessType.INSERT)
  145. @PostMapping("/insertYiInfo")
  146. public AjaxResult<Void> insertYiInfo(@RequestBody TenantCovenantInfoAddBo bo) {
  147. return toAjax(iBsCovenantService.insertYiInfo(bo) ? 1 : 0);
  148. }
  149. /**
  150. * 新增企业协议
  151. */
  152. @ApiOperation("业务系统新增协议")
  153. @Log(title = "企业协议", businessType = BusinessType.INSERT)
  154. @PostMapping("/insertYw")
  155. public AjaxResult<Void> addYW(@RequestBody BsCovenantAddBo bo) {
  156. bo.setFormApp(3L);
  157. return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0);
  158. }
  159. /**
  160. * 修改企业协议
  161. */
  162. @ApiOperation("复制新增")
  163. @Log(title = "企业协议", businessType = BusinessType.UPDATE)
  164. @PostMapping("/copyAndInsert")
  165. public AjaxResult<Void> copyAndInsert(@RequestBody BsCovenantAddBo bo) {
  166. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  167. bo.setUserId(loginUser.getUser().getUserId());
  168. bo.setFormApp(1L);
  169. return toAjax(iBsCovenantService.insertYXTByAddBo(bo) ? 1 : 0);
  170. }
  171. /**
  172. * 修改企业协议
  173. */
  174. @ApiOperation("修改重提")
  175. @Log(title = "企业协议", businessType = BusinessType.UPDATE)
  176. @PostMapping("/updateCommit")
  177. public AjaxResult<Void> copyAndInsert(@RequestBody BsCovenantEditBo bo) {
  178. return toAjax(iBsCovenantService.updateByEditBo(bo) ? 1 : 0);
  179. }
  180. /**
  181. * 删除企业协议
  182. */
  183. @ApiOperation("协议取消")
  184. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  185. @PostMapping("/cancelStatus")
  186. public AjaxResult<Void> cancelStatus(@RequestBody BsCovenantEditBo bo) {
  187. return toAjax(iBsCovenantService.deleteWithValidByIds(bo.getCovenantId()) ? 1 : 0);
  188. }
  189. /**
  190. * 删除企业协议
  191. */
  192. @ApiOperation("生成协议编号")
  193. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  194. @GetMapping("/getCovenantNum")
  195. public AjaxResult<Void> getCovenantNum() {
  196. return AjaxResult.success(iBsCovenantService.getCovenantNum());
  197. }
  198. /**
  199. * 删除企业协议
  200. */
  201. @ApiOperation("判断当前业务类型是否有已知存在协议")
  202. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  203. @PostMapping("/judgeBusiness")
  204. public AjaxResult judgeBusiness(@RequestParam("businessId") Long businessId) {
  205. Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
  206. return AjaxResult.success(iBsCovenantService.getJudgeBusiness(businessId,userId));
  207. }
  208. @ApiOperation(value = "导出协议pdf培训服务证书")
  209. @GetMapping("/download")
  210. public AjaxResult download(@RequestParam("covenantId") Long covenantId) {
  211. return AjaxResult.success(iBsCovenantService.exportPdf(covenantId));
  212. }
  213. @ApiOperation(value = "云学堂判断当前选择甲方是否存在待审核或者申请终止审核")
  214. @GetMapping("/judgeExistYW")
  215. public AjaxResult judgeExistYW(@RequestParam("companyId") Long companyId) {
  216. return AjaxResult.success(iBsCovenantService.judgeExistYW(companyId));
  217. }
  218. /**
  219. * 删除企业协议
  220. */
  221. @ApiOperation("终止申请")
  222. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  223. @PostMapping("/updateStopStatus")
  224. public AjaxResult<Void> updateStopStatus(@RequestBody BsCovenantEditBo bo) {
  225. return toAjax(iBsCovenantService.updateStopStatus(bo.getCovenantId()) ? 1 : 0);
  226. }
  227. /**
  228. * 删除企业协议
  229. */
  230. @ApiOperation("取消终止申请")
  231. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  232. @PostMapping("/cancelStopStatus")
  233. public AjaxResult<Void> cancelStopStatus(@RequestBody BsCovenantEditBo bo) {
  234. return toAjax(iBsCovenantService.cancelStopStatus(bo.getCovenantId()) ? 1 : 0);
  235. }
  236. /**
  237. * 删除企业协议
  238. */
  239. @ApiOperation("协议审核")
  240. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  241. @PostMapping("/updateCheckStatus")
  242. public AjaxResult updateCheckStatus(@RequestBody NoCheckInfo noCheckInfo) {
  243. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  244. return toAjax(iBsCovenantService.updateCheckStatus(noCheckInfo, loginUser.getUser().getUserId()) ? 1 : 0);
  245. }
  246. /**
  247. * 删除企业协议
  248. */
  249. @ApiOperation("终止审核")
  250. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  251. @PostMapping("/updateStopCheck")
  252. public AjaxResult updateStopCheck(@RequestBody NoCheckInfo noCheckInfo) {
  253. LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
  254. return toAjax(iBsCovenantService.updateStopCheck(noCheckInfo, loginUser.getUser().getUserId()) ? 1 : 0);
  255. }
  256. /**
  257. * 删除企业协议
  258. */
  259. @ApiOperation("协议上传")
  260. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  261. @PostMapping("/uploadImg")
  262. public AjaxResult uploadImg(@RequestBody BsCovenantEditBo bo) {
  263. return toAjax(iBsCovenantService.uploadImg(bo.getCovenantId(), bo.getPaths()) ? 1 : 0);
  264. }
  265. /**
  266. * 删除企业协议
  267. */
  268. @ApiOperation("协议上传确认生效")
  269. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  270. @PostMapping("/confirmAssert")
  271. public AjaxResult confirmAssert(@RequestBody BsCovenantEditBo bo) {
  272. return toAjax(iBsCovenantService.confirmAssert(bo.getCovenantId()) ? 1 : 0);
  273. }
  274. /**
  275. * 删除企业协议
  276. */
  277. @ApiOperation("统计协议审核待审核数量")
  278. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  279. @PostMapping("/countNoCheckNum")
  280. public AjaxResult countNoCheckNum() {
  281. Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
  282. return AjaxResult.success(iBsCovenantService.countNoCheckNum(userId, 1L));
  283. }
  284. /**
  285. * 删除企业协议
  286. */
  287. @ApiOperation("统计终止审核待审核数量")
  288. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  289. @PostMapping("/countStopNoCheckNum")
  290. public AjaxResult countStopNoCheckNum() {
  291. Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
  292. return AjaxResult.success(iBsCovenantService.countStopNoCheckNum(userId, 1L));
  293. }
  294. @ApiOperation("统计协议上传数量")
  295. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  296. @PostMapping("/countUploadImgNum")
  297. public AjaxResult countUploadImgNum() {
  298. Long userId = tokenService.getLoginUser(ServletUtils.getRequest()).getUser().getUserId();
  299. return AjaxResult.success(iBsCovenantService.countUploadImgNum(userId, 1L));
  300. }
  301. @ApiOperation("获取审核意见列表")
  302. @Log(title = "企业协议", businessType = BusinessType.DELETE)
  303. @GetMapping("/getCheckInfo")
  304. public TableDataInfo<CovenantCheckRecordVo> getCheckInfo(@RequestParam("covenantId") Long covenantId) {
  305. return getDataTable(iBsCovenantService.getNoCheckInfo(covenantId));
  306. }
  307. }