|
|
@@ -1,22 +1,31 @@
|
|
|
package com.zd.bottle.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.zd.bottle.domain.UsegasApply;
|
|
|
+import com.zd.bottle.domain.UsegasAuditRecord;
|
|
|
import com.zd.bottle.service.UsegasApplyService;
|
|
|
+import com.zd.bottle.service.UsegasAuditRecordService;
|
|
|
+import com.zd.bottle.vo.UsegasApplyDetailVo;
|
|
|
import com.zd.bottle.vo.UsegasApplyTabVo;
|
|
|
import com.zd.bottle.vo.UsegasApplyVo;
|
|
|
import com.zd.common.core.domain.per.PerFun;
|
|
|
import com.zd.common.core.domain.per.PerPrefix;
|
|
|
+import com.zd.common.core.utils.SecurityUtils;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
import com.zd.common.core.web.page.TableDataInfo;
|
|
|
import com.zd.common.response.ResultData;
|
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
|
+import com.zd.common.security.service.TokenService;
|
|
|
+import com.zd.common.security.utils.SaveUtil;
|
|
|
+import com.zd.system.api.domain.SysUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -34,6 +43,10 @@ public class UsegasApplyController extends BaseController<UsegasApply> {
|
|
|
|
|
|
@Autowired
|
|
|
private UsegasApplyService usegasApplyService;
|
|
|
+ @Autowired
|
|
|
+ private UsegasAuditRecordService usegasAuditRecordService;
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
|
|
|
@ApiModelProperty(value = "待审核")
|
|
|
@PreAuthorize(hasPermi = PerPrefix.QP_USEGASAPPLY + PerFun.LIST)
|
|
|
@@ -72,4 +85,65 @@ public class UsegasApplyController extends BaseController<UsegasApply> {
|
|
|
UsegasApplyTabVo usegasApplyTabVo = usegasApplyService.selectApplyTabCount(usegasApply);
|
|
|
return ResultData.success(usegasApplyTabVo);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**---------------------------------- 用气申请 -------------------------------------*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前登录用户信息
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取当前登录用户信息")
|
|
|
+ @GetMapping("/getLoginUser")
|
|
|
+ public ResultData<SysUser> getLoginUser(){
|
|
|
+ //获取当前登录用户信息
|
|
|
+ SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
+ return ResultData.success(sysUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "个人申请列表")
|
|
|
+ @PostMapping("/listByUser")
|
|
|
+ public TableDataInfo<UsegasApply> queryApplyListByUser(@RequestBody UsegasApply usegasApply){
|
|
|
+
|
|
|
+ startPage();
|
|
|
+ QueryWrapper<UsegasApply> wrapper = new QueryWrapper();
|
|
|
+ wrapper.eq("user_id", SecurityUtils.getUserId());
|
|
|
+ wrapper.eq("lead_audit_staus", usegasApply.getLeadAuditStaus());
|
|
|
+ List<UsegasApply> list = usegasApplyService.list(wrapper);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "个人提交申请")
|
|
|
+ @PostMapping("/addByUser")
|
|
|
+ public ResultData<UsegasApplyTabVo> addApplyByUser(@RequestBody @Valid UsegasApply usegasApply){
|
|
|
+ if(usegasApply.getUserId() == null || !usegasApply.getUserId().equals(SecurityUtils.getUserId())){
|
|
|
+ return ResultData.fail("参数异常!");
|
|
|
+ }
|
|
|
+ SaveUtil.setCommonAttr(usegasApply);
|
|
|
+ usegasApplyService.save(usegasApply);
|
|
|
+ return ResultData.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "申请详情")
|
|
|
+ @PostMapping("/detail")
|
|
|
+ public ResultData<UsegasApplyDetailVo> queryApplyDetail(@RequestBody UsegasApply usegasApply){
|
|
|
+
|
|
|
+ UsegasApplyDetailVo usegasApplyDetailVo = new UsegasApplyDetailVo();
|
|
|
+
|
|
|
+ usegasApply = usegasApplyService.getById(usegasApply.getId());
|
|
|
+
|
|
|
+ if(usegasApply == null){
|
|
|
+ return ResultData.fail("未查询到数据!");
|
|
|
+ }
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(usegasApply, usegasApplyDetailVo);
|
|
|
+
|
|
|
+ QueryWrapper<UsegasAuditRecord> queryWrapper = new QueryWrapper();
|
|
|
+
|
|
|
+ queryWrapper.eq("usegas_apply_id", usegasApplyDetailVo.getId());
|
|
|
+ List<UsegasAuditRecord> list = usegasAuditRecordService.list(queryWrapper);
|
|
|
+
|
|
|
+ usegasApplyDetailVo.setDetails(list);
|
|
|
+
|
|
|
+ return ResultData.success(usegasApplyDetailVo);
|
|
|
+ }
|
|
|
}
|