feat: 喝酒报备日志
This commit is contained in:
parent
b3b27b2fa4
commit
fbc87a89c4
|
@ -6,17 +6,23 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.database.domain.NonWorkingDayDrinkingReport;
|
import com.ruoyi.database.domain.NonWorkingDayDrinkingReport;
|
||||||
import com.ruoyi.database.domain.dto.ApprovaltDto;
|
import com.ruoyi.database.domain.dto.ApprovaltDto;
|
||||||
|
import com.ruoyi.database.domain.gwglLog;
|
||||||
import com.ruoyi.database.service.NonWorkingDayDrinkingReportService;
|
import com.ruoyi.database.service.NonWorkingDayDrinkingReportService;
|
||||||
|
import com.ruoyi.database.service.gwglLogService;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -33,6 +39,7 @@ import java.util.stream.Collectors;
|
||||||
public class NonWorkingDayDrinkingReportController extends BaseController {
|
public class NonWorkingDayDrinkingReportController extends BaseController {
|
||||||
private final NonWorkingDayDrinkingReportService nonWorkingDayDrinkingReportService;
|
private final NonWorkingDayDrinkingReportService nonWorkingDayDrinkingReportService;
|
||||||
private final ISysDeptService deptService;
|
private final ISysDeptService deptService;
|
||||||
|
private final gwglLogService gwglLogService;
|
||||||
|
|
||||||
@ApiOperation("查询非工作日饮酒报备单")
|
@ApiOperation("查询非工作日饮酒报备单")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ -62,26 +69,26 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
||||||
} else if (leader.contains(user.getNickName())) {
|
} else if (leader.contains(user.getNickName())) {
|
||||||
// 单位领导
|
// 单位领导
|
||||||
queryWrapper.eq("dept_id", user.getDeptId());
|
queryWrapper.eq("dept_id", user.getDeptId());
|
||||||
queryWrapper.eq("user_type",0);
|
queryWrapper.eq("user_type", 0);
|
||||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||||
return getDataTableEnhance(list, count);
|
return getDataTableEnhance(list, count);
|
||||||
} else if ("刘成志".equals(user.getNickName())) {
|
} else if ("刘成志".equals(user.getNickName())) {
|
||||||
// 前、现局党委成员
|
// 前、现局党委成员
|
||||||
queryWrapper.eq("user_type",2);
|
queryWrapper.eq("user_type", 2);
|
||||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||||
return getDataTableEnhance(list, count);
|
return getDataTableEnhance(list, count);
|
||||||
}else if (leaderLeader.contains(user.getNickName())){
|
} else if (leaderLeader.contains(user.getNickName())) {
|
||||||
// 分管局领导
|
// 分管局领导
|
||||||
queryWrapper.eq("user_type",1);
|
queryWrapper.eq("user_type", 1);
|
||||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||||
return getDataTableEnhance(list, count);
|
return getDataTableEnhance(list, count);
|
||||||
}else {
|
} else {
|
||||||
// 自己
|
// 自己
|
||||||
queryWrapper.eq("user_id", user.getUserId());
|
queryWrapper.eq("user_id", user.getUserId());
|
||||||
queryWrapper.eq("user_type",1);
|
queryWrapper.eq("user_type", 1);
|
||||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||||
return getDataTableEnhance(list, count);
|
return getDataTableEnhance(list, count);
|
||||||
|
@ -107,6 +114,7 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
||||||
if (nonWorkingDayDrinkingReport.getId() == null) {
|
if (nonWorkingDayDrinkingReport.getId() == null) {
|
||||||
nonWorkingDayDrinkingReport.setCreateBy(user.getNickName());
|
nonWorkingDayDrinkingReport.setCreateBy(user.getNickName());
|
||||||
nonWorkingDayDrinkingReport.setState(0);
|
nonWorkingDayDrinkingReport.setState(0);
|
||||||
|
nonWorkingDayDrinkingReport.setApplyNo(OrderNumberGenerator());
|
||||||
nonWorkingDayDrinkingReport.setName(user.getNickName());
|
nonWorkingDayDrinkingReport.setName(user.getNickName());
|
||||||
nonWorkingDayDrinkingReport.setUserId(user.getUserId());
|
nonWorkingDayDrinkingReport.setUserId(user.getUserId());
|
||||||
nonWorkingDayDrinkingReport.setDeptName(user.getDept().getDeptName());
|
nonWorkingDayDrinkingReport.setDeptName(user.getDept().getDeptName());
|
||||||
|
@ -151,14 +159,38 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
||||||
@ApiOperation("审批非工作日饮酒报备单")
|
@ApiOperation("审批非工作日饮酒报备单")
|
||||||
@PostMapping("/approval")
|
@PostMapping("/approval")
|
||||||
public AjaxResult approval(@RequestBody ApprovaltDto dto) {
|
public AjaxResult approval(@RequestBody ApprovaltDto dto) {
|
||||||
|
SysUser user = getLoginUser().getUser();
|
||||||
Long id = dto.getId();
|
Long id = dto.getId();
|
||||||
Integer state = dto.getState();
|
Integer state = dto.getState();
|
||||||
NonWorkingDayDrinkingReport nonWorkingDayDrinkingReport = nonWorkingDayDrinkingReportService.getById(id);
|
NonWorkingDayDrinkingReport nonWorkingDayDrinkingReport = nonWorkingDayDrinkingReportService.getById(id);
|
||||||
nonWorkingDayDrinkingReport.setState(state);
|
nonWorkingDayDrinkingReport.setState(state);
|
||||||
boolean result = nonWorkingDayDrinkingReportService.updateById(nonWorkingDayDrinkingReport);
|
boolean result = nonWorkingDayDrinkingReportService.updateById(nonWorkingDayDrinkingReport);
|
||||||
if (!result) {
|
gwglLog gwglLog = new gwglLog();
|
||||||
|
gwglLog.setApplyNo(nonWorkingDayDrinkingReport.getApplyNo());
|
||||||
|
gwglLog.setDeptId(nonWorkingDayDrinkingReport.getDeptId());
|
||||||
|
gwglLog.setDeptName(nonWorkingDayDrinkingReport.getDeptName());
|
||||||
|
gwglLog.setUserId(nonWorkingDayDrinkingReport.getUserId());
|
||||||
|
gwglLog.setUserName(nonWorkingDayDrinkingReport.getName());
|
||||||
|
gwglLog.setCreateTime(nonWorkingDayDrinkingReport.getCreateTime());
|
||||||
|
gwglLog.setReason(nonWorkingDayDrinkingReport.getReason());
|
||||||
|
gwglLog.setType(1);
|
||||||
|
gwglLog.setChecker(user.getNickName());
|
||||||
|
gwglLog.setCheckTime(LocalDateTime.now());
|
||||||
|
gwglLog.setCheckState(state);
|
||||||
|
boolean result1 = gwglLogService.save(gwglLog);
|
||||||
|
if (!result || !result1) {
|
||||||
return AjaxResult.error("审批非工作日饮酒报备单失败");
|
return AjaxResult.error("审批非工作日饮酒报备单失败");
|
||||||
}
|
}
|
||||||
return AjaxResult.success("审批非工作日饮酒报备单成功");
|
return AjaxResult.success("审批非工作日饮酒报备单成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
private static final String DATA_KEY = "DDATAKEY:";
|
||||||
|
|
||||||
|
public static String OrderNumberGenerator() {
|
||||||
|
String format = sdf.format(new Date());
|
||||||
|
RedisCache bean = SpringUtils.getBean(RedisCache.class);
|
||||||
|
bean.setCacheObject(DATA_KEY + format, bean.getCacheObject(DATA_KEY + format) == null ? 1 : (Integer) (bean.getCacheObject(DATA_KEY + format)) + 1);
|
||||||
|
return format + String.format("%04d", (Integer) (bean.getCacheObject(DATA_KEY + format)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.ruoyi.business.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.database.domain.gwglLog;
|
||||||
|
import com.ruoyi.database.service.gwglLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description gwglLogController
|
||||||
|
* @Author lijingtong
|
||||||
|
* @Date 2025-06-06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Api(tags = "审批日志")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/gwglLog")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class gwglLogController extends BaseController {
|
||||||
|
|
||||||
|
private final gwglLogService gwglLogService;
|
||||||
|
|
||||||
|
@ApiOperation("查询审批日志")
|
||||||
|
@RequestMapping("/list")
|
||||||
|
public TableDataInfo query(@RequestBody gwglLog gwglLog){
|
||||||
|
startPage();
|
||||||
|
QueryWrapper<gwglLog> queryWrapper = new QueryWrapper<>(gwglLog);
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
return getDataTable(gwglLogService.list(queryWrapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据编号查询日志")
|
||||||
|
@RequestMapping("/detail/{applyNo}")
|
||||||
|
public TableDataInfo detail(@PathVariable String applyNo){
|
||||||
|
QueryWrapper<gwglLog> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("apply_no", applyNo);
|
||||||
|
List<gwglLog> list = gwglLogService.list(queryWrapper);
|
||||||
|
long size = list.size();
|
||||||
|
return getDataTableEnhance(list, size);
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,9 @@ public class NonWorkingDayDrinkingReport {
|
||||||
@ApiModelProperty("主键ID")
|
@ApiModelProperty("主键ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请编号")
|
||||||
|
private String applyNo;
|
||||||
|
|
||||||
@ApiModelProperty("姓名")
|
@ApiModelProperty("姓名")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.database.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description DwglLog
|
||||||
|
* @Author lijingtong
|
||||||
|
* @Date 2025-06-06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("gwgl_log")
|
||||||
|
@ApiModel("非工作日饮酒报备单")
|
||||||
|
public class gwglLog {
|
||||||
|
@ApiModelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请编号")
|
||||||
|
private String applyNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门ID")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请人ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请人姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请原因")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("审核人")
|
||||||
|
private String checker;
|
||||||
|
|
||||||
|
@ApiModelProperty("审核时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime checkTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("审核状态")
|
||||||
|
private Integer checkState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ruoyi.database.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.database.domain.gwglLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description gwglLogMapper
|
||||||
|
* @Author lijingtong
|
||||||
|
* @Date 2025-06-06
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface gwglLogMapper extends BaseMapper<gwglLog> {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.ruoyi.database.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.database.domain.gwglLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description gwglLogService
|
||||||
|
* @Author lijingtong
|
||||||
|
* @Date 2025-06-06
|
||||||
|
*/
|
||||||
|
public interface gwglLogService extends IService<gwglLog> {
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.ruoyi.database.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.database.domain.gwglLog;
|
||||||
|
import com.ruoyi.database.mapper.gwglLogMapper;
|
||||||
|
import com.ruoyi.database.service.gwglLogService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description gwglLogServiceImpl
|
||||||
|
* @Author lijingtong
|
||||||
|
* @Date 2025-06-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class gwglLogServiceImpl extends ServiceImpl<gwglLogMapper, gwglLog> implements gwglLogService {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue