Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a7bef13051
|
@ -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.SysUser;
|
||||
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.dto.ApprovaltDto;
|
||||
import com.ruoyi.database.domain.gwglLog;
|
||||
import com.ruoyi.database.service.NonWorkingDayDrinkingReportService;
|
||||
import com.ruoyi.database.service.gwglLogService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -33,6 +39,7 @@ import java.util.stream.Collectors;
|
|||
public class NonWorkingDayDrinkingReportController extends BaseController {
|
||||
private final NonWorkingDayDrinkingReportService nonWorkingDayDrinkingReportService;
|
||||
private final ISysDeptService deptService;
|
||||
private final gwglLogService gwglLogService;
|
||||
|
||||
@ApiOperation("查询非工作日饮酒报备单")
|
||||
@GetMapping("/list")
|
||||
|
@ -62,26 +69,26 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
|||
} else if (leader.contains(user.getNickName())) {
|
||||
// 单位领导
|
||||
queryWrapper.eq("dept_id", user.getDeptId());
|
||||
queryWrapper.eq("user_type",0);
|
||||
queryWrapper.eq("user_type", 0);
|
||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||
return getDataTableEnhance(list, count);
|
||||
} else if ("刘成志".equals(user.getNickName())) {
|
||||
// 前、现局党委成员
|
||||
queryWrapper.eq("user_type",2);
|
||||
queryWrapper.eq("user_type", 2);
|
||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||
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);
|
||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||
return getDataTableEnhance(list, count);
|
||||
}else {
|
||||
} else {
|
||||
// 自己
|
||||
queryWrapper.eq("user_id", user.getUserId());
|
||||
queryWrapper.eq("user_type",1);
|
||||
queryWrapper.eq("user_type", 1);
|
||||
List<NonWorkingDayDrinkingReport> list = nonWorkingDayDrinkingReportService.list(queryWrapper);
|
||||
long count = nonWorkingDayDrinkingReportService.count(queryWrapper);
|
||||
return getDataTableEnhance(list, count);
|
||||
|
@ -107,6 +114,7 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
|||
if (nonWorkingDayDrinkingReport.getId() == null) {
|
||||
nonWorkingDayDrinkingReport.setCreateBy(user.getNickName());
|
||||
nonWorkingDayDrinkingReport.setState(0);
|
||||
nonWorkingDayDrinkingReport.setApplyNo(OrderNumberGenerator());
|
||||
nonWorkingDayDrinkingReport.setName(user.getNickName());
|
||||
nonWorkingDayDrinkingReport.setUserId(user.getUserId());
|
||||
nonWorkingDayDrinkingReport.setDeptName(user.getDept().getDeptName());
|
||||
|
@ -115,6 +123,7 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
|||
// 单位领导
|
||||
nonWorkingDayDrinkingReport.setUserType(1);
|
||||
} else if (leaderLeader.contains(user.getNickName())) {
|
||||
// 局党委和分管局成员
|
||||
nonWorkingDayDrinkingReport.setUserType(2);
|
||||
} else {
|
||||
// 普通民警
|
||||
|
@ -150,14 +159,38 @@ public class NonWorkingDayDrinkingReportController extends BaseController {
|
|||
@ApiOperation("审批非工作日饮酒报备单")
|
||||
@PostMapping("/approval")
|
||||
public AjaxResult approval(@RequestBody ApprovaltDto dto) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
Long id = dto.getId();
|
||||
Integer state = dto.getState();
|
||||
NonWorkingDayDrinkingReport nonWorkingDayDrinkingReport = nonWorkingDayDrinkingReportService.getById(id);
|
||||
nonWorkingDayDrinkingReport.setState(state);
|
||||
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.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)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,14 @@ 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.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.database.domain.PoliceLeaveApproval;
|
||||
import com.ruoyi.database.domain.dto.ApprovaltDto;
|
||||
import com.ruoyi.database.service.PoliceLeaveApprovalService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description PoliceLeaveApprovalController
|
||||
|
@ -29,11 +33,23 @@ import java.util.List;
|
|||
public class PoliceLeaveApprovalController extends BaseController {
|
||||
|
||||
private final PoliceLeaveApprovalService policeLeaveApprovalService;
|
||||
private final ISysDeptService deptService;
|
||||
private final ISysUserService userService;
|
||||
|
||||
@RequestMapping("/list")
|
||||
@ApiOperation("查询")
|
||||
public TableDataInfo list(PoliceLeaveApproval policeLeaveApproval) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysDept> sysDepts = deptService.selectAllDeptList();
|
||||
// 局领导
|
||||
List<SysUser> users = userService.getList("131000");
|
||||
// 部门领导
|
||||
List<String> leader = sysDepts.stream().map(SysDept::getLeader).collect(Collectors.toList());
|
||||
// 局党委和分管局成员
|
||||
List<String> leaderLeader = sysDepts.stream().map(SysDept::getLeaderLeader).distinct().collect(Collectors.toList());
|
||||
|
||||
startPage();
|
||||
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String fTime = policeLeaveApproval.getFTime();
|
||||
String eTime = policeLeaveApproval.getETime();
|
||||
|
@ -44,26 +60,70 @@ public class PoliceLeaveApprovalController extends BaseController {
|
|||
if (fTime != null && fTime != null) {
|
||||
queryWrapper.between("create_time", time, time1);
|
||||
}
|
||||
if (leader.contains(user.getNickName())) {
|
||||
// 部门领导和政治处侍昌鑫看普通民警
|
||||
queryWrapper.eq("user_type", 0);
|
||||
queryWrapper.eq("state", 0);
|
||||
} else if ("侍昌鑫".equals(user.getNickName())) {
|
||||
queryWrapper.in("user_type", 0,1);
|
||||
queryWrapper.eq("state", 0);
|
||||
} else if ("admin".equals(user.getUserName())) {
|
||||
// 管理员看所有
|
||||
}else if ("刘成志".equals(user.getNickName()) || "陈列".equals(user.getNickName())){
|
||||
// 主要局领导
|
||||
queryWrapper.eq("state", 3);
|
||||
} else if (leaderLeader.contains(user.getNickName())) {
|
||||
// 分管局
|
||||
queryWrapper.eq("user_type", 1);
|
||||
}else if (users.contains(user.getNickName()) ) {
|
||||
// 局领导
|
||||
queryWrapper.eq("user_type", 1);
|
||||
|
||||
}else {
|
||||
// 自己看自己
|
||||
queryWrapper.eq("user_id", user.getUserId());
|
||||
}
|
||||
List<PoliceLeaveApproval> list = policeLeaveApprovalService.list(new QueryWrapper<>(policeLeaveApproval));
|
||||
long size = list.size();
|
||||
return getDataTableEnhance(list,size);
|
||||
return getDataTableEnhance(list, size);
|
||||
}
|
||||
|
||||
@ApiOperation("新增或修改民警请(休)假审批表 传id为修改 不传id为新增")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody PoliceLeaveApproval policeLeaveApproval){
|
||||
public AjaxResult add(@RequestBody PoliceLeaveApproval policeLeaveApproval) {
|
||||
List<SysDept> sysDepts = deptService.selectAllDeptList();
|
||||
// 部门领导
|
||||
List<String> leader = sysDepts.stream().map(SysDept::getLeader).collect(Collectors.toList());
|
||||
// 局党委和分管局成员
|
||||
List<String> leaderLeader = sysDepts.stream().map(SysDept::getLeaderLeader).distinct().collect(Collectors.toList());
|
||||
|
||||
SysUser user = getLoginUser().getUser();
|
||||
if (policeLeaveApproval.getId() == null) {
|
||||
policeLeaveApproval.setName(user.getNickName());
|
||||
policeLeaveApproval.setIdCard(user.getIdCard());
|
||||
policeLeaveApproval.setPhone(user.getPhonenumber());
|
||||
policeLeaveApproval.setState(0);
|
||||
policeLeaveApproval.setDeptName(user.getDept().getDeptName());
|
||||
policeLeaveApproval.setCreateBy(user.getNickName());
|
||||
policeLeaveApproval.setUserId(user.getUserId());
|
||||
policeLeaveApproval.setDeptId(user.getDeptId());
|
||||
|
||||
if (leader.contains(user.getNickName())) {
|
||||
// 单位领导
|
||||
policeLeaveApproval.setUserType(1);
|
||||
} else if (leaderLeader.contains(user.getNickName())) {
|
||||
// 局党委和分管局成员
|
||||
policeLeaveApproval.setUserType(2);
|
||||
} else {
|
||||
// 普通民警
|
||||
policeLeaveApproval.setUserType(0);
|
||||
}
|
||||
boolean result = policeLeaveApprovalService.save(policeLeaveApproval);
|
||||
if (!result) {
|
||||
return AjaxResult.error("新增民警请(休)假审批表失败");
|
||||
}
|
||||
return AjaxResult.success(result);
|
||||
}else {
|
||||
} else {
|
||||
policeLeaveApproval.setUpdateBy(user.getNickName());
|
||||
boolean result = policeLeaveApprovalService.updateById(policeLeaveApproval);
|
||||
if (!result) {
|
||||
|
|
|
@ -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")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("申请编号")
|
||||
private String applyNo;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ public class PoliceLeaveApproval {
|
|||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String idCard;
|
||||
|
||||
|
@ -32,9 +35,15 @@ public class PoliceLeaveApproval {
|
|||
@ApiModelProperty("联系电话")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("用户类型 0-普通民警 1-部门领导 2-分管局成员")
|
||||
private Integer userType;
|
||||
|
||||
@ApiModelProperty("所在单位")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("单位id")
|
||||
private Long deptId;
|
||||
|
||||
@ApiModelProperty("请假天数")
|
||||
private String days;
|
||||
|
||||
|
@ -52,7 +61,7 @@ public class PoliceLeaveApproval {
|
|||
private LocalDateTime endDate;
|
||||
|
||||
|
||||
@ApiModelProperty("审批流程 0-未审批 1-部门审批通过 2-部门审批不通过 3-警务保障部门审批通过 4-警务保障部门审批不通过 5-局领导审批通过 6-局领导审批不通过")
|
||||
@ApiModelProperty("审批流程 0-未审批 1-部门审批通过 2-部门审批不通过 3-政治处审批通过 4-政治处审批不通过 5-局领导审批通过 6-局领导审批不通过")
|
||||
@TableField(condition = SqlCondition.EQUAL)
|
||||
private Integer state;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue