This commit is contained in:
parent
96af4f42f5
commit
51a5d0bc6b
|
@ -21,6 +21,7 @@ import com.ruoyi.database.service.BusinessTripApprovalService;
|
|||
import com.ruoyi.database.service.gwglLogService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -66,6 +67,9 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
@ApiOperation("新增出差申请")
|
||||
public AjaxResult add(@RequestBody BusinessTripApproval dto) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
if (dto.getHasOffcialCar() == null) {
|
||||
throw new RuntimeException("请选择是否自带公务车辆");
|
||||
}
|
||||
if (dto.getHasOffcialCar() != null && dto.getHasOffcialCar() == 1) {
|
||||
if (dto.getCarModel() == null) {
|
||||
throw new RuntimeException("请选择使用车型");
|
||||
|
@ -87,6 +91,10 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
dto.setUserId(user.getUserId());
|
||||
dto.setDepartment(user.getDept().getDeptName());
|
||||
List<Long> togUserIdList = dto.getTogUserIdList();
|
||||
int isLeader = 0;
|
||||
if (user.getIsLeader() != null) {
|
||||
isLeader = 1;
|
||||
}
|
||||
StringBuilder ids = new StringBuilder();
|
||||
if (togUserIdList != null && !togUserIdList.isEmpty()) {
|
||||
for (Long aLong : togUserIdList) {
|
||||
|
@ -94,6 +102,10 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
ids.append(",");
|
||||
}
|
||||
ids.append(aLong);
|
||||
SysUser user1 = sysUserService.selectUserById(aLong);
|
||||
if (user1.getIsLeader() != null) {
|
||||
isLeader = 1;
|
||||
}
|
||||
}
|
||||
dto.setTogUserIds(ids.toString());
|
||||
}
|
||||
|
@ -102,7 +114,6 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
dto.setApplyNo(s);
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String uuids = uuid.toString();
|
||||
|
||||
dto.setUuid(uuids);
|
||||
BaseAddressInfo byId = baseAddressInfoService.getById(dto.getDestinationId());
|
||||
ApprovalProcess approvalProcess = new ApprovalProcess();
|
||||
|
@ -112,15 +123,30 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
approvalProcess.setSubmitterId(user.getUserId());
|
||||
approvalProcess.setSubmitTime(new Date().getTime());
|
||||
approvalProcess.setMatterType(2);
|
||||
approvalProcess.setApprovalStatus(0);
|
||||
approvalProcess.setReadStatus(0);
|
||||
approvalProcess.setBusinessTripDestination(byId.getAddName());
|
||||
approvalProcess.setStartTime(dto.getStartDate());
|
||||
approvalProcess.setEndTime(dto.getEndDate());
|
||||
approvalProcess.setCreateTime(new Date().getTime());
|
||||
approvalProcess.setUuid(uuids);
|
||||
approvalsProcessService.save(approvalProcess);
|
||||
return toAjax(businessTripApprovalService.save(dto));
|
||||
List<Long> longs = new ArrayList<>();
|
||||
if (isLeader == 1) {
|
||||
if (dto.getHasOffcialCar() == 1) {
|
||||
approvalProcess.setApprovalStatus(100);
|
||||
longs.add(2165L);
|
||||
} else {
|
||||
approvalProcess.setApprovalStatus(400);
|
||||
longs.add(1660L);
|
||||
longs.add(1661L);
|
||||
}
|
||||
} else {
|
||||
approvalProcess.setApprovalStatus(1);
|
||||
longs.add(user.getDept().getLeaderId());
|
||||
}
|
||||
addLog(approvalProcess,longs);
|
||||
return toAjax(businessTripApprovalService.save(dto)
|
||||
&& approvalsProcessService.save(approvalProcess)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,6 +228,7 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||
private static final String DATA_KEY = "DDATAKEY:";
|
||||
|
||||
|
@ -241,4 +268,28 @@ public class BusinessTripApprovalController extends BaseController {
|
|||
return AjaxResult.success("审批出差申请成功");
|
||||
}
|
||||
|
||||
|
||||
public Boolean addLog(ApprovalProcess approvalProcess, List<Long> userIds) {
|
||||
gwglLog gwglLog = new gwglLog();
|
||||
gwglLog.setUserId(approvalProcess.getSubmitterId());
|
||||
gwglLog.setUserName(approvalProcess.getSubmitterName());
|
||||
gwglLog.setCheckState(0);
|
||||
gwglLog.setUuid(approvalProcess.getUuid());
|
||||
gwglLog.setApprovalStatus(approvalProcess.getApprovalStatus());
|
||||
SysUser user = new SysUser();
|
||||
StringBuilder name = new StringBuilder();
|
||||
for (Long userId : userIds) {
|
||||
SysUser user1 = sysUserService.selectUserById(userId);
|
||||
if (name.length() > 0) {
|
||||
name.append(",");
|
||||
}
|
||||
name.append(user1.getNickName());
|
||||
}
|
||||
gwglLog.setChecker(name.toString());
|
||||
if (user.getDept() != null) {
|
||||
gwglLog.setCheckDeptName(user.getDept().getDeptName());
|
||||
}
|
||||
gwglLog.setCheckDeptId(user.getDeptId());
|
||||
return gwglLogService.save(gwglLog);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ public class ApprovalProcess {
|
|||
@ApiModelProperty("审批状态:0-待提交 1-部门审批中 2-政治处审批中 3-局领导审批中 4-已通过 5-已拒绝")
|
||||
@TableField(condition = SqlCondition.LIKE)
|
||||
private Integer approvalStatus;
|
||||
@TableField(exist = false)
|
||||
private String approvalStatusCn;
|
||||
|
||||
@ApiModelProperty("到达日期")
|
||||
private Long arrivalDate;
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package com.ruoyi.database.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntityMini;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -95,4 +97,9 @@ public class BusinessTripApproval extends BaseEntityMini {
|
|||
@TableField(exist = false)
|
||||
private List<SysUser> togUserList;
|
||||
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.database.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.SqlCondition;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -58,7 +60,21 @@ public class gwglLog {
|
|||
|
||||
@ApiModelProperty("审核状态")
|
||||
private Integer checkState;
|
||||
@TableField(exist = false)
|
||||
private String checkStateCn;
|
||||
|
||||
@ApiModelProperty("uuid")
|
||||
private String uuid;
|
||||
|
||||
@ApiModelProperty("审核人部门")
|
||||
private String checkDeptName;
|
||||
|
||||
@ApiModelProperty("审核人部门id")
|
||||
private Long checkDeptId;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("审批状态")
|
||||
private Integer approvalStatus;
|
||||
@TableField(exist = false)
|
||||
private String approvalStatusCn;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.database.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.database.domain.ApprovalProcess;
|
||||
import com.ruoyi.database.domain.gwglLog;
|
||||
|
||||
/**
|
||||
|
@ -10,5 +11,4 @@ import com.ruoyi.database.domain.gwglLog;
|
|||
*/
|
||||
public interface gwglLogService extends IService<gwglLog> {
|
||||
|
||||
public void addLog();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.database.service.impl;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.database.domain.ApprovalProcess;
|
||||
import com.ruoyi.database.domain.gwglLog;
|
||||
import com.ruoyi.database.mapper.gwglLogMapper;
|
||||
import com.ruoyi.database.service.gwglLogService;
|
||||
|
@ -14,8 +16,4 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class gwglLogServiceImpl extends ServiceImpl<gwglLogMapper, gwglLog> implements gwglLogService {
|
||||
|
||||
@Override
|
||||
public void addLog() {
|
||||
gwglLog gwglLog = new gwglLog();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public class SysDept extends BaseEntity
|
|||
/** 负责人 */
|
||||
private String leader;
|
||||
|
||||
private Long leaderId;
|
||||
|
||||
/** 负责人 */
|
||||
private String leaderLeader;
|
||||
|
||||
|
@ -212,4 +214,12 @@ public class SysDept extends BaseEntity
|
|||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public Long getLeaderId() {
|
||||
return leaderId;
|
||||
}
|
||||
|
||||
public void setLeaderId(Long leaderId) {
|
||||
this.leaderId = leaderId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ public class SysUser extends BaseEntity
|
|||
|
||||
private Integer hasApproval;
|
||||
|
||||
private Integer isLeader;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
|
@ -439,4 +441,12 @@ public class SysUser extends BaseEntity
|
|||
public void setShoeSize(String shoeSize) {
|
||||
this.shoeSize = shoeSize;
|
||||
}
|
||||
|
||||
public Integer getIsLeader() {
|
||||
return isLeader;
|
||||
}
|
||||
|
||||
public void setIsLeader(Integer isLeader) {
|
||||
this.isLeader = isLeader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<result property="shoeSize" column="shoe_size" />
|
||||
<result property="areaAuthCode" column="area_auth_code" />
|
||||
<result property="userNum" column="user_num" />
|
||||
<result property="isLeader" column="is_leader" />
|
||||
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
@ -43,6 +44,7 @@
|
|||
<result property="ancestors" column="ancestors" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="leaderId" column="leader_id" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
|
||||
|
@ -56,7 +58,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id,u.user_num,u.hat_size,u.bottoms_size,u.tops_size,u.shoe_size,u.has_approval,
|
||||
select u.user_id,u.user_num,u.hat_size,u.bottoms_size,u.tops_size,u.shoe_size,u.has_approval,u.is_leader,
|
||||
u.user_type_cn,u.id_card, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.area_auth_code,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
|
@ -67,7 +69,7 @@
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id,u.user_num,u.hat_size,u.bottoms_size,u.tops_size,u.has_approval,u.shoe_size,u.user_type_cn,u.id_card, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.area_auth_code, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
select u.user_id,u.user_num,u.hat_size,u.bottoms_size,u.tops_size,u.has_approval,u.is_leader,u.shoe_size,u.user_type_cn,u.id_card, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.area_auth_code, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
|
|
Loading…
Reference in New Issue