Commit 80de54e3 authored by ZhangRunSong's avatar ZhangRunSong
parents f2431b08 e5bf24dd
......@@ -198,4 +198,15 @@ public class ProjectManageController extends BaseController
List<ProjectManage> projectManageList = projectManageService.selectProjectManageList(new ProjectManage());
return AjaxResult.success(projectManageList);
}
/*
* 获取草稿箱项目列表
* 下拉框
* */
@GetMapping("/getDraftProjectList")
public AjaxResult getDraftProjectList()
{
List<ProjectManage> projectManageList = projectManageService.selectProjectManageListDraft(new ProjectManage());
return AjaxResult.success(projectManageList);
}
}
......@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class ProjectNumberGenerator {
// 存储当天每种类型的项目计数器
private static final ConcurrentHashMap<String, AtomicInteger> projectCounter = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, AtomicInteger> PROJECT_COUNTER = new ConcurrentHashMap<>();
/**
* 生成项目编号
......@@ -22,9 +22,9 @@ public class ProjectNumberGenerator {
// 用于区分不同类型的项目
String key = currentDate + type;
// 如果该类型今天没有生成过编号,则初始化计数器为 1
projectCounter.computeIfAbsent(key, k -> new AtomicInteger(1));
PROJECT_COUNTER.computeIfAbsent(key, k -> new AtomicInteger(1));
// 获取当前计数器值并递增
int count = projectCounter.get(key).getAndIncrement();
int count = PROJECT_COUNTER.get(key).getAndIncrement();
// 格式化序号为三位数
String formattedCount = String.format("%03d", count);
return currentDate + type + formattedCount;
......
package com.ruoyi.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ProjectCostRequestApproval;
import com.ruoyi.service.IExpenseApprovalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
//费用审批
@RestController
@RequestMapping("/expenseApproval")
public class ExpenseApprovalController extends BaseController {
@Autowired
private IExpenseApprovalService expenseApprovalService;
//获取当前登录用户角色列表
@GetMapping("/getAllRoleList")
public AjaxResult getAllRoleList(){
return AjaxResult.success(expenseApprovalService.getExpenseApproval());
}
//项目费用申请-审批通过
@PostMapping("/projectCostRequestApproval")
public AjaxResult projectCostRequestApproval(@RequestBody List<ProjectCostRequestApproval> fyglProjectCostDTO) {
System.out.println("审批 = " + fyglProjectCostDTO);
return AjaxResult.success(expenseApprovalService.updateStatus(fyglProjectCostDTO));
}
}
......@@ -4,14 +4,13 @@ import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.dto.FyglProjectCostDTO;
import com.ruoyi.domain.dto.FyglTripApplicationDTO;
import com.ruoyi.domain.vo.FyglDailyReimbursementVo;
import com.ruoyi.domain.vo.FyglTripApplicationVo;
import com.ruoyi.service.IFyglTripApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -42,4 +41,25 @@ public class FyglTripApplicationController extends BaseController {
{
return success(fyglTripApplicationService.selectFyglTripApplicationById(id));
}
//新增出差申请
@PostMapping("/insert")
public AjaxResult insertFyglTripApplication(@RequestBody FyglTripApplicationDTO fyglTripApplicationDTO)
{
return AjaxResult.success(fyglTripApplicationService.insertFyglTripApplication(fyglTripApplicationDTO));
}
//修改出差申请
@PutMapping("/update")
public AjaxResult updateFyglTripApplication(@RequestBody FyglTripApplicationDTO fyglTripApplicationDTO)
{
return AjaxResult.success(fyglTripApplicationService.updateFyglTripApplication(fyglTripApplicationDTO));
}
//删除出差申请
@DeleteMapping("/{id}")
public AjaxResult deleteFyglTripApplication(@PathVariable Long id)
{
return toAjax(fyglTripApplicationService.deleteFyglTripApplicationById(id));
}
}
package com.ruoyi.domain;
import lombok.Data;
//项目费用审批实体
@Data
public class ProjectCostRequestApproval {
//项目费用id
private Integer projectCostId;
//下一个节点nodeId
private Integer nextNodeId;
//是否终审
private Boolean isEndApproval;
//整体审核状态
private Integer approveStatus;
}
package com.ruoyi.domain;
import lombok.Data;
//角色名称和id
@Data
public class RoleNameAndId {
private Integer roleId;
private String roleName;
}
package com.ruoyi.domain.dto;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
@Data
public class FyglTripApplicationDTO {
public class FyglTripApplicationDTO extends BaseEntity {
private Long id;
//项目id
private Long projectId;
//项目编号
private String projectNumber;
//项目名称
......@@ -19,6 +22,8 @@ public class FyglTripApplicationDTO {
private String tripStartDate;
//预计结束时间
private String tripEndDate;
//出差天数
private double days;
//项目经理
private String projectUserName;
//审批状态
......
package com.ruoyi.mapper;
import com.ruoyi.domain.ProjectCostRequestApproval;
import com.ruoyi.domain.RoleNameAndId;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ExpenseApprovalMapper{
List<RoleNameAndId> getRolesByUserId(Long userId);
//修改项目费用申请的审核状态
int updateStatus(ProjectCostRequestApproval projectCostRequestApproval);
}
package com.ruoyi.mapper;
import com.ruoyi.domain.dto.FyglTripApplicationDTO;
import com.ruoyi.domain.vo.FyglDailyReimbursementVo;
import com.ruoyi.domain.vo.FyglTripApplicationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -15,16 +16,41 @@ import java.util.List;
@Mapper
public interface FyglTripApplicationMapper {
/**
* 查询日常报销
* 查询出差申请
*
* @param id 日常报销主键
* @return 日常报销
* @param id 出差申请主键
* @return 出差申请
*/
public FyglTripApplicationDTO selectFyglTripApplicationById(Long id);
/**
* 查询出差申请列表
*
* @return 出差申请集合
*/
public List<FyglTripApplicationDTO> selectTripApplicationList(FyglTripApplicationVo fyglTripApplicationVO);
/**
* 新增出差申请
*
* @param fyglTripApplicationDTO 出差申请
* @return 结果
*/
public int insertFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO);
/**
* 修改日常报销
*
* @param fyglTripApplicationDTO 出差申请
* @return 结果
*/
public int updateFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO);
/**
* 删除出差申请
*
* @param id 出差申请主键
* @return 结果
*/
public int deleteFyglTripApplicationById(Long id);
}
package com.ruoyi.material.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import cn.hutool.core.util.ArrayUtil;
import com.ruoyi.attendance.enums.AttendanceDelFlag;
import com.ruoyi.attendance.enums.AttendanceDraft;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.material.domain.PsaMaterial;
import com.ruoyi.material.domain.PsaMaterialType;
import com.ruoyi.material.domain.PsaMaterialTypeDetail;
import com.ruoyi.material.domain.dto.EditMaterialDTO;
import com.ruoyi.material.domain.dto.MaterialQueryDTO;
import com.ruoyi.material.domain.dto.PsaMaterialNewDTO;
import com.ruoyi.material.mapper.PsaMaterialMapper;
import com.ruoyi.material.service.IPsaMaterialService;
import com.ruoyi.materialentry.domain.PsaMaterialEntry;
import com.ruoyi.materialentry.mapper.PsaMaterialEntryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.material.mapper.PsaMaterialMapper;
import com.ruoyi.material.domain.PsaMaterial;
import com.ruoyi.material.service.IPsaMaterialService;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
* 物品信息Service业务层处理
*
......
package com.ruoyi.service;
import com.ruoyi.domain.ProjectCostRequestApproval;
import com.ruoyi.domain.RoleNameAndId;
import java.util.List;
public interface IExpenseApprovalService {
//获取当前角色名字和id
List<RoleNameAndId> getExpenseApproval();
//修改项目费用申请的审核状态
int updateStatus(List<ProjectCostRequestApproval> projectCostRequestApproval);
}
......@@ -23,23 +23,22 @@ public interface IFyglTripApplicationService {
* @return 出差申请集合
*/
public List<FyglTripApplicationDTO> selectFyglTripApplicationList(FyglTripApplicationVo fyglTripApplicationVO);
FyglProjectDTO getProjectDetail(Long pid);
/**
* 新增出差申请
*
* @param fyglDailyReimbursement 出差申请
* @param fyglTripApplicationDTO 出差申请
* @return 结果
*/
public int insertFyglTripApplication(FyglDailyReimbursement fyglDailyReimbursement);
public int insertFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO);
List<FyglProjectList> getProjectList();
/**
* 修改日常报销
*
* @param fyglDailyReimbursement 日常报销
* @param fyglTripApplicationDTO 日常报销
* @return 结果
*/
public int updateFyglTripApplication(FyglDailyReimbursement fyglDailyReimbursement);
public int updateFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO);
/**
* 批量删除日常报销
......
......@@ -108,6 +108,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
// int i1 = fyglDailyReimbursementMapper.insertFyglDailyReimbursement(fyglDailyReimbursement);
//第二层表
fyglDailyReimbursement.setStatus(2);
fyglDailyReimbursement.setRegistrationTime(DateUtils.getNowDate());
System.out.println();
int i2 = fyglDailyReimbursementMapper.insertFyglDailyReimbursement2(fyglDailyReimbursement);
......
package com.ruoyi.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.FyglDailyReimbursement;
import com.ruoyi.domain.dto.*;
import com.ruoyi.domain.vo.FyglTripApplicationVo;
......@@ -8,6 +10,7 @@ import com.ruoyi.service.IFyglTripApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
......@@ -44,23 +47,22 @@ public class FyglTripApplicationServiceImpl implements IFyglTripApplicationServi
}
@Override
public FyglProjectDTO getProjectDetail(Long pid) {
return null;
public int insertFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO) {
fyglTripApplicationDTO.setCreateBy(SecurityUtils.getUsername());
Date nowDate = DateUtils.getNowDate();
fyglTripApplicationDTO.setCreateTime(nowDate);
fyglTripApplicationDTO.setUpdateBy(SecurityUtils.getUsername());
fyglTripApplicationDTO.setUpdateTime(nowDate);
//设置1未通过2审批中3已通过
fyglTripApplicationDTO.setStatus(2);
return fyglTripApplicationMapper.insertFyglTripApplication(fyglTripApplicationDTO);
}
@Override
public int insertFyglTripApplication(FyglDailyReimbursement fyglDailyReimbursement) {
return 0;
}
@Override
public List<FyglProjectList> getProjectList() {
return null;
}
@Override
public int updateFyglTripApplication(FyglDailyReimbursement fyglDailyReimbursement) {
return 0;
public int updateFyglTripApplication(FyglTripApplicationDTO fyglTripApplicationDTO) {
fyglTripApplicationDTO.setUpdateBy(SecurityUtils.getUsername());
fyglTripApplicationDTO.setUpdateTime(DateUtils.getNowDate());
return fyglTripApplicationMapper.updateFyglTripApplication(fyglTripApplicationDTO);
}
@Override
......@@ -70,6 +72,6 @@ public class FyglTripApplicationServiceImpl implements IFyglTripApplicationServi
@Override
public int deleteFyglTripApplicationById(Long id) {
return 0;
return fyglTripApplicationMapper.deleteFyglTripApplicationById(id);
}
}
package com.ruoyi.service.impl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ProjectCostRequestApproval;
import com.ruoyi.domain.RoleNameAndId;
import com.ruoyi.mapper.ExpenseApprovalMapper;
import com.ruoyi.service.IExpenseApprovalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class IExpenseApprovalServiceImpl implements IExpenseApprovalService {
@Autowired
private ExpenseApprovalMapper expenseApprovalMapper;
@Override
public List<RoleNameAndId> getExpenseApproval() {
Long userId = SecurityUtils.getUserId();
System.out.println("userId = " + userId);
return expenseApprovalMapper.getRolesByUserId(userId);
}
@Override
@Transactional
public int updateStatus(List<ProjectCostRequestApproval> projectCostRequestApproval) {
for(ProjectCostRequestApproval p : projectCostRequestApproval){
//如果是最终审批,那么项目整体审批状态为已通过
if(p.getIsEndApproval()){
p.setApproveStatus(3);
}
expenseApprovalMapper.updateStatus(p);
}
return 1;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.ExpenseApprovalMapper">
<update id="updateStatus" parameterType="com.ruoyi.domain.ProjectCostRequestApproval">
update fygl_project_cost_request
<trim prefix="SET" suffixOverrides=",">
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
<if test="nextNodeId != null">current_audit_role_id = #{nextNodeId}</if>
</trim>
where id = #{projectCostId}
</update>
<select id="getRolesByUserId" resultType="com.ruoyi.domain.RoleNameAndId">
SELECT
ru.role_id as roleId,
r.role_name as roleName
FROM
sys_user_role ru,
sys_role r
WHERE
ru.user_id = #{userId}
AND ru.role_id = r.role_id
</select>
</mapper>
\ No newline at end of file
......@@ -92,9 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
r1.id,
r1.serial_number,
r1.create_time,
r1.update_time,
r1.reimbursement,
r2.create_by,
r2.update_time,
p.project_name,
p.project_number,
p.project_type,
......@@ -102,12 +102,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(SELECT u.user_name FROM sys_user u WHERE u.user_id = p.department_leader_id) AS depart_name
FROM
fygl_daily_rembursement_relevancy_r r1,
fygl_daily_reimbursement r2,
project_manage p
WHERE
r1.id = #{id}
AND r1.did = r2.id
AND p.id = r2.project_id
AND p.id = r1.project_id
</select>
<select id="getItemList" resultType="com.ruoyi.domain.dto.FyglDailyReimbursementTableItemDTO">
......@@ -201,7 +199,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="accessory != null">accessory,</if>
<if test="serialNumber != null">serial_number,</if>
<if test="registrationTime != null">registration_time,</if>
<if test="reimbursement != null">reimbursement</if>
<if test="reimbursement != null">reimbursement,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
......@@ -209,7 +212,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="accessory != null">#{accessory},</if>
<if test="serialNumber != null">#{serialNumber},</if>
<if test="registrationTime != null">#{registrationTime},</if>
<if test="reimbursement != null">#{reimbursement}</if>
<if test="reimbursement != null">#{reimbursement},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark}</if>
</trim>
</insert>
<insert id="insertFyglDailyReimbursement3">
......
......@@ -6,6 +6,7 @@
<resultMap type="com.ruoyi.domain.dto.FyglTripApplicationDTO" id="FyglTripApplicationDTOResult">
<result property="id" column="id" />
<result property="projectId" column="project_id"/>
<result property="projectName" column="project_name" />
<result property="projectUserName" column="project_manager_name" />
<result property="projectType" column="project_type"/>
......@@ -39,7 +40,6 @@
<if test="projectType != null and projectType != ''"> and p.project_type = #{projectType}</if>
<if test="tripStartDate != null and tripStartDate != ''"> and ftr.travel_start_date = #{tripStartDate}</if>
<if test="status != null and status != ''"> and ftr.status = #{status}</if>
<!-- <if test="reimbursement != null and reimbursement != ''">and fdr.reimbursement = #{reimbursement}</if>-->
<if test="projectName != null and projectName != ''"> and p.project_name LIKE CONCAT('%', #{projectName}, '%')</if>
</where>
GROUP BY ftr.id
......@@ -48,6 +48,7 @@
<select id="selectFyglTripApplicationById" parameterType="Long" resultMap="FyglTripApplicationDTOResult">
SELECT
ftr.id,
ftr.project_id,
p.project_number,
p.project_name,
p.project_type,
......@@ -64,4 +65,55 @@
WHERE
ftr.id = #{id}
</select>
<insert id="insertFyglTripApplication" parameterType="com.ruoyi.domain.dto.FyglTripApplicationDTO">
insert into fygl_travel_request
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="projectId != null">project_id,</if>
<if test="tripAddress != null">travel_address,</if>
<if test="tripReason != null">travel_cause,</if>
<if test="tripStartDate != null">travel_start_date,</if>
<if test="tripEndDate != null">travel_end_date,</if>
<if test="days != null">days,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="projectId != null">#{projectId},</if>
<if test="tripAddress != null">#{tripAddress},</if>
<if test="tripReason != null">#{tripReason},</if>
<if test="tripStartDate != null">#{tripStartDate},</if>
<if test="tripEndDate != null">#{tripEndDate},</if>
<if test="days != null">#{days},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark}</if>
</trim>
</insert>
<update id="updateFyglTripApplication" parameterType="com.ruoyi.domain.dto.FyglTripApplicationDTO">
update fygl_travel_request
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="tripAddress != null">travel_address = #{tripAddress},</if>
<if test="tripReason != null">travel_cause = #{tripReason},</if>
<if test="tripStartDate != null">travel_start_date = #{tripStartDate},</if>
<if test="tripEndDate != null">travel_end_date = #{tripEndDate},</if>
<if test="days != null">days = #{days},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFyglTripApplicationById" parameterType="Long">
delete from fygl_travel_request where id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectType != null and projectType != ''">
and project_type = #{projectType}</if>
<if test="departmentLeaderId!= null ">
and pm.department_leader_id = #{departmentL}</if>
and pm.department_leader_id = #{departmentLeaderId}</if>
<if test="projectManagerId!= null ">
and pm.project_manager_id = #{projectManagerId}</if>
<if test="projectStatus != null and projectStatus != ''">
......@@ -82,6 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join project_member pmem on pmem.project_id = pm.id
left join sys_user su on su.user_id = pmem.user_id
where pm.del_flag = '0' and pm.draft = '0'
<if test="id != null and id != ''">
and pm.id = #{id}
</if>
<if test="projectNumber != null and projectNumber != ''">
and pm.project_number = #{projectNumber}</if>
<if test="projectName != null and projectName != ''">
......@@ -89,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectType != null and projectType != ''">
and project_type = #{projectType}</if>
<if test="departmentLeaderId!= null ">
and pm.department_leader_id = #{departmentL}</if>
and pm.department_leader_id = #{departmentLeaderId}</if>
<if test="projectManagerId!= null ">
and pm.project_manager_id = #{projectManagerId}</if>
<if test="projectStatus != null and projectStatus != ''">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment