| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- package com.qdport.controller;
- import com.qdport.annotation.WebLog;
- import com.qdport.entity.PolicyShare;
- import com.qdport.enums.QDPortEnum;
- import com.qdport.modules.system.entity.SysDept;
- import com.qdport.modules.system.service.SysDeptService;
- import com.qdport.query.PolicyShareQuery;
- import com.qdport.service.PolicyFileService;
- import com.qdport.service.PolicyLogService;
- import com.qdport.service.PolicyShareService;
- import com.qdport.service.PolicyTodoService;
- import com.qdport.vo.PolicyFileVO;
- import com.qdport.vo.PolicyLogVO;
- import com.qdport.vo.PolicyShareVO;
- import com.qdport.wrapper.PolicyShareWrapper;
- import org.springframework.web.bind.annotation.*;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import com.qdport.core.tool.api.R;
- import com.qdport.core.tool.utils.Func;
- import com.qdport.core.boot.ctrl.QdportController;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.validation.Valid;
- import java.util.*;
- import java.util.concurrent.ExecutionException;
- /**
- * 政策共享
- *
- * @author yuheng
- * @since 1.0.0 2024-09-30
- */
- @RestController
- @RequestMapping("qdport-zcgx/share")
- @Api(value = "政策共享", tags = "政策共享")
- public class PolicyShareController extends QdportController {
- @Resource
- private PolicyShareService policyShareService;
- @Resource
- private PolicyFileService policyFileService;
- @Resource
- private PolicyTodoService policyTodoService;
- @Resource
- private SysDeptService sysDeptService;
- /**
- * 分页
- */
- @GetMapping("page")
- @ApiOperation(value = "分页", notes = "分页")
- public R<IPage<PolicyShareVO>> page(@Valid PolicyShareQuery query) {
- IPage<PolicyShareVO> page = policyShareService.page(query);
- List<PolicyShareVO> records = page.getRecords();
- for (PolicyShareVO model : records) {
- SysDept dept = sysDeptService.getById(model.getDeptId());
- model.setDeptName(dept.getName());
- SysDept company = sysDeptService.getById(model.getCompanyId());
- model.setCompanyName(company.getName());
- List<PolicyFileVO> fileList = policyFileService.getFileList(model.getId(), QDPortEnum.POLICY_FILE_REFTYPE_POLICY_SHARE.getValue());
- model.setFileList(fileList);
- }
- return R.data(page);
- }
- /**
- * 详情
- */
- @GetMapping("{id}")
- @ApiOperation(value = "详情", notes = "id")
- public R<PolicyShareVO> get(@PathVariable("id") String id) {
- PolicyShare entity = policyShareService.getById(id);
- PolicyShareVO vo = PolicyShareWrapper.build().entityVO(entity);
- SysDept dept = sysDeptService.getById(vo.getDeptId());
- vo.setDeptName(dept.getName());
- SysDept company = sysDeptService.getById(vo.getCompanyId());
- vo.setCompanyName(company.getName());
- List<PolicyFileVO> fileList = policyFileService.getFileList(entity.getId().toString(), QDPortEnum.POLICY_FILE_REFTYPE_POLICY_SHARE.getValue());
- vo.setFileList(fileList);
- return R.data(vo);
- }
- /**
- * 新增
- */
- @PostMapping("/save")
- @ApiOperation(value = "新增", notes = "传入PolicyShare")
- @WebLog(operateName = "新增", operateType = "policy_share")
- public R save(@RequestBody PolicyShareVO vo) {
- vo.setStatus(QDPortEnum.POLICY_SHARE_STATUS_ACTIVE.getValue());
- policyShareService.save(vo);
- return R.success("保存成功");
- }
- @PostMapping("/saveDone")
- @ApiOperation(value = "新增", notes = "传入PolicyShare")
- @WebLog(operateName = "管理员新增", operateType = "policy_share")
- public R saveDone(@RequestBody PolicyShareVO vo) {
- vo.setStatus(QDPortEnum.POLICY_SHARE_STATUS_DONE.getValue());
- policyShareService.save(vo);
- return R.success("保存成功");
- }
- @PostMapping("/saveApprove")
- @ApiOperation(value = "新增并且提交", notes = "传入PolicyShare")
- @WebLog(operateName = "新增并且上报", operateType = "policy_share")
- public R saveApprove(@RequestBody PolicyShareVO vo) throws ExecutionException, InterruptedException {
- policyShareService.saveApprove(vo);
- policyTodoService.save(vo);
- return R.success("新增并且提交成功");
- }
- /**
- * 修改
- */
- @PostMapping("/update")
- @ApiOperation(value = "编辑", notes = "传入PolicyShare")
- @WebLog(operateName = "修改", operateType = "policy_share")
- public R update(@RequestBody @Valid PolicyShareVO vo) {
- policyShareService.update(vo);
- return R.success("更新成功");
- }
- @PostMapping("/withdraw")
- @ApiOperation(value = "撤回", notes = "传入PolicyShare")
- @WebLog(operateName = "撤回", operateType = "policy_share")
- public R withdraw(@RequestBody @Valid PolicyShareVO vo) {
- policyShareService.withdraw(vo);
- return R.success("撤回成功");
- }
- @PostMapping("/approve")
- @ApiOperation(value = "审核通过", notes = "传入PolicyShare")
- @WebLog(operateName = "审核通过", operateType = "policy_share")
- public R approve(@RequestBody @Valid PolicyShareVO vo) throws ExecutionException, InterruptedException {
- vo.setIsWithdraw(0);
- policyShareService.approve(vo);
- policyTodoService.save(vo);
- return R.success("更新成功");
- }
- @PostMapping("/refuse")
- @ApiOperation(value = "审核拒绝", notes = "传入PolicyShare")
- @WebLog(operateName = "审核拒绝", operateType = "policy_share")
- public R refuse(@RequestBody @Valid PolicyShareVO vo) {
- vo.setIsWithdraw(1);
- policyShareService.refuse(vo);
- return R.success("更新成功");
- }
- @PostMapping("/resubmit")
- @ApiOperation(value = "重新提交", notes = "传入PolicyShare")
- @WebLog(operateName = "重新上报", operateType = "policy_share")
- public R resubmit(@RequestBody @Valid PolicyShareVO vo) throws ExecutionException, InterruptedException {
- vo.setStatus(QDPortEnum.POLICY_SHARE_STATUS_APPROVE.getValue());
- policyShareService.approve(vo);
- policyTodoService.save(vo);
- return R.success("重新发起成功");
- }
- /**
- * 删除
- */
- @PostMapping("/remove")
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
- @WebLog(operateName = "删除", operateType = "policy_share")
- public R delete(@ApiParam(value = "主键集合", required = true) @RequestParam(name = "ids") String ids) {
- List<String> idList = Func.toStrList(ids);
- policyShareService.delete(idList);
- return R.success("删除成功");
- }
- }
|