Przeglądaj źródła

提交财务审核模块

Lijy 11 miesięcy temu
rodzic
commit
204c6cf364

+ 82 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinancialAuditController.java

@@ -0,0 +1,82 @@
+package com.management.platform.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.management.platform.entity.FinancialAudit;
+import com.management.platform.entity.Project;
+import com.management.platform.entity.ProjectStage;
+import com.management.platform.entity.User;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.service.FinancialAuditService;
+import com.management.platform.service.ProjectStageService;
+import com.management.platform.util.HttpRespMsg;
+import com.management.platform.util.MessageUtils;
+import io.lettuce.core.pubsub.PubSubOutput;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-05
+ */
+@RestController
+@RequestMapping("/financial-audit")
+public class FinancialAuditController {
+    @Autowired
+    private FinancialAuditService financialAuditService;
+    @Resource
+    private UserMapper userMapper;
+
+    @RequestMapping("/list")
+    public HttpRespMsg list(Integer pageIndex, Integer pageSize, String startDate, String endDate, Integer status, HttpServletRequest request) throws ParseException {
+        HttpRespMsg httpRespMsg = new HttpRespMsg(); 
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();  
+        QueryWrapper<FinancialAudit> queryWrapper = new QueryWrapper<FinancialAudit>()  
+            .eq("company_id", companyId)  
+            .eq("review_status", status)  
+            .ge("report_yrMnth", startDate)
+            .le("report_yrMnth", endDate);
+        IPage<FinancialAudit> auditIPage = financialAuditService.page(new Page<FinancialAudit>(pageIndex, pageSize), queryWrapper);
+        Map<String, Object> map = new HashMap<>();
+        map.put("records", auditIPage.getRecords());
+        map.put("total", auditIPage.getTotal());
+    
+        httpRespMsg.data = map;  
+        return httpRespMsg;
+    }
+
+    @RequestMapping("/audit")
+    public HttpRespMsg audit(Integer id, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String token = request.getHeader("Token");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        User user = userMapper.selectById(token);
+//                financialAuditService.update().eq("id", id).set("review_status", 2).set("reviewer_id", user.getId()).set("reviewer_name", user.getName());
+        FinancialAudit item = new FinancialAudit();
+        item.setId(id);
+        item.setReviewStatus(2);
+        item.setReviewerId(user.getId());
+        item.setReviewerName(user.getName());
+        item.setReviewTime(sdf.format(new Date()));
+        financialAuditService.updateById(item);
+        return httpRespMsg;
+    }
+}
+

+ 83 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/FinancialAudit.java

@@ -0,0 +1,83 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class FinancialAudit extends Model<FinancialAudit> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 财务审核id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 日报年月
+     */
+    @TableField("report_yrMnth")
+    @DateTimeFormat(pattern = "yyyy-MM")
+    @JsonFormat(pattern = "yyyy-MM")
+    private LocalDate reportYrmnth;
+
+    /**
+     * 审核人_id
+     */
+    @TableField("reviewer_id")
+    private String reviewerId;
+
+    /**
+     * 审核人_name
+     */
+    @TableField("reviewer_name")
+    private String reviewerName;
+
+    /**
+     * 审核时间
+     */
+    @TableField("review_time")
+    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd hh:mm")
+    private String reviewTime;
+
+    /**
+     * 审核状态,1-未审核,2-已审核
+     */
+    @TableField("review_status")
+    private Integer reviewStatus;
+
+    /**
+     * 对应公司
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/FinancialAuditMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.FinancialAudit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-05
+ */
+public interface FinancialAuditMapper extends BaseMapper<FinancialAudit> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/FinancialAuditService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.FinancialAudit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-05
+ */
+public interface FinancialAuditService extends IService<FinancialAudit> {
+
+}

+ 20 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinancialAuditServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.FinancialAudit;
+import com.management.platform.mapper.FinancialAuditMapper;
+import com.management.platform.service.FinancialAuditService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2024-06-05
+ */
+@Service
+public class FinancialAuditServiceImpl extends ServiceImpl<FinancialAuditMapper, FinancialAudit> implements FinancialAuditService {
+
+}

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/FinancialAuditMapper.xml

@@ -0,0 +1,21 @@
+<?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.management.platform.mapper.FinancialAuditMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.FinancialAudit">
+        <id column="id" property="id" />
+        <result column="report_yrMnth" property="reportYrmnth" />
+        <result column="reviewer_id" property="reviewerId" />
+        <result column="reviewer_name" property="reviewerName" />
+        <result column="review_time" property="reviewTime" />
+        <result column="review_status" property="reviewStatus" />
+        <result column="company_id" property="companyId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, report_yrMnth, reviewer_id, reviewer_name, review_time, review_status, company_id
+    </sql>
+
+</mapper>

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -26,7 +26,8 @@
     "basicDataManagemen": "Basic Data Managemen",
     "basicSystemSettings": "Basic System Settings",
     "roleRightsManagement": "Role Rights Management",
-    "gongshitongji":"工时统计表"
+    "gongshitongji":"工时统计表",
+    "caiwushenhe":"财务审核"
   },
   "role": {
     "ordinaryEmployees": "Ordinary employees",

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -28,7 +28,8 @@
     "roleRightsManagement": "角色权限管理",
     "projectFormSettings": "项目表单设置",
     "budgetReview":"预估工时审核",
-    "gongshitongji":"工时统计表"
+    "gongshitongji":"工时统计表",
+    "caiwushenhe":"财务审核"
   },
   "role": {
     "ordinaryEmployees": "普通员工",

+ 16 - 0
fhKeeper/formulahousekeeper/timesheet/src/routes.js

@@ -93,6 +93,9 @@ import projectForm from './views/project/projectForm'
 // 预算工时审核
 import budgetReview from './views/project/budgetReview'
 
+// 财务审核
+import financeAudit from './views/financeAudit/financeAudit.vue'
+
 Vue.use(Router)
 
 export const fixedRouter = [
@@ -457,6 +460,19 @@ export const allRouters = [//组织架构
         // 其他信息
         meta: { text: 'navigation.approvalFlowSettings' } 
     },
+    {
+        
+        path: '/',
+        component: Home,
+        name: '财务审核',
+        iconCls: 'iconfont firerock-iconliucheng',
+        leaf: true,//只有一个节点
+        children: [
+            { path: '/financeAudit', component: financeAudit, name: '财务审核' },
+        ],
+        // 其他信息
+        meta: { text: 'navigation.caiwushenhe' } 
+    },
     //设置时间类型
     // {
         

+ 5 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue

@@ -193,8 +193,8 @@
 
             <section class="content-container">
                 <div class="contentMask" v-if="vTourFlg"></div>
-                <div class="grid-content bg-purple-light">
-                    <el-col :span="24" class="content-wrapper">
+                <div class="grid-content h-full bg-purple-light">
+                    <el-col :span="24" class="content-wrapper h-full">
                         <transition name="fade" mode="out-in">
                             <router-view></router-view>
                         </transition>
@@ -1127,6 +1127,9 @@
             top: 60px;
             bottom: 0px;
             overflow: hidden;
+            .h-full {
+                height: 100%;
+            }
             aside {
                 flex: 0 0 230px;
                 width: 230px;

+ 211 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/financeAudit/financeAudit.vue

@@ -0,0 +1,211 @@
+<template>
+    <div class='financeAudit'>
+        <div class="fAd_hrader">
+            <div class="items">
+                <div class="label">年月:</div>
+                <div class="value">
+                    <el-date-picker v-model="tableForm.dates" type="monthrange" range-separator="至" start-placeholder="开始日期"
+                        @change="getFinanceAuditTableData()" size="small" value-format="yyyy-MM" end-placeholder="结束日期">
+                    </el-date-picker>
+                </div>
+            </div>
+            <div class="items">
+                <div class="label">审核状态:</div>
+                <div class="value">
+                    <el-select v-model="tableForm.status" placeholder="请选择" size="small"
+                        @change="getFinanceAuditTableData()">
+                        <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
+                        </el-option>
+                    </el-select>
+                </div>
+            </div>
+        </div>
+        <div class="fAd_content">
+            <el-table :data="financeAuditTableData" border style="width: 100%;height: 100%;"
+                v-loading="allLoading.tableLoading">
+                <el-table-column prop="reportYrmnth" label="日报年月" align="center">
+                    <template slot-scope="scope">
+                        <el-button type="text" @click="toDetail()">{{ scope.row.reportYrmnth }}</el-button>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="reviewerName" label="审核人" align="center"></el-table-column>
+                <el-table-column prop="reviewTime" label="审核时间" align="center"></el-table-column>
+                <el-table-column prop="reviewStatus" label="状态" align="center">
+                    <template slot-scope="scope">
+                        {{ scope.row.reviewStatus == 1 ? '未审核' : '已审核' }}
+                    </template>
+                </el-table-column>
+                <el-table-column label="操作" align="center" v-if="tableForm.status == 1" fixed="right">
+                    <template slot-scope="scope">
+                        <el-button @click="audit(scope.row)" type="text">审核</el-button>
+                        <el-button type="text" @click="toDetail()">查看详情</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+        </div>
+        <div class="fAd_footer">
+            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                :current-page="paging.pageIndex" :page-sizes="[50, 100, 200, 500]" :page-size="paging.pageSize"
+                layout="total, prev, pager, next, sizes" :total="paging.total">
+            </el-pagination>
+        </div>
+    </div>
+</template>
+
+<script>
+export default {
+    name: '',
+    components: {},
+    props: {},
+    data() {
+        return {
+            tableForm: {
+                dates: [],
+                status: 1,
+            },
+            financeAuditTableData: [],
+            statusOptions: [
+                { value: 1, label: '未审核' },
+                { value: 2, label: '已审核' },
+            ],
+            paging: {
+                pageSize: 50,
+                pageIndex: 1,
+                total: 0
+            },
+            allLoading: {
+                tableLoading: false
+            }
+        }
+    },
+    computed: {},
+    watch: {},
+    created() { },
+    mounted() {
+        let firstMonth = this.dayjs().startOf('year').format('YYYY-MM')
+        let currentMonth = this.dayjs().format('YYYY-MM')
+        this.tableForm.dates = [firstMonth, currentMonth]
+        this.getFinanceAuditTableData()
+    },
+    methods: {
+        toDetail() {
+            this.$router.push({
+                path: '/cost',
+                query: {
+                    startDate: this.tableForm.dates[0],
+                    endDate: this.tableForm.dates[1]
+                }
+            })
+        },
+        audit(item) {
+            this.$confirm(`您确定要审核通过${item.reportYrmnth}月的工时报告吗?`, '财务审核提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                this.postData('/financial-audit/audit', { id: item.id }).then(res => {
+                    this.$message({
+                        type: 'success',
+                        message: '审核成功!'
+                    });
+                    this.getFinanceAuditTableData();
+                });
+            }).catch(() => {});
+        },
+        getFinanceAuditTableData() {
+            this.allLoading.tableLoading = true
+            let param = {
+                pageSize: this.paging.pageSize,
+                pageIndex: this.paging.pageIndex,
+                startDate: this.tableForm.dates[0] + '-01' || '',
+                endDate: this.tableForm.dates[1] + '-01' || '',
+                status: this.tableForm.status || '',
+            }
+            this.postData('/financial-audit/list', param).then(({ data }) => {
+                const { total, records } = data
+                this.financeAuditTableData = records
+                this.paging.total = total
+            }).finally(() => {
+                this.allLoading.tableLoading = false
+            })
+        },
+        handleSizeChange(val) {
+            this.paging.pageSize = val
+            this.paging.pageIndex = 1
+            this.getFinanceAuditTableData()
+        },
+        handleCurrentChange(val) {
+            this.paging.pageIndex = val
+            this.getFinanceAuditTableData()
+        },
+        // 单独封装请求
+        async postData(urls, param) {
+            return new Promise((resolve, reject) => {
+                this.http.post(urls, { ...param },
+                    res => {
+                        if (res.code == 'ok') {
+                            resolve(res)
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: 'error'
+                            })
+                            reject(res)
+                        }
+                        resolve(res)
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        reject(error)
+                    }
+                )
+            });
+        }
+    },
+}
+</script>
+<style scoped lang='scss'>
+* {
+    box-sizing: border-box;
+}
+
+.financeAudit {
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+
+    .fAd_hrader {
+        background-color: #F2F2F2;
+        padding: 10px 15px;
+        display: flex;
+
+        .items {
+            display: flex;
+            align-items: center;
+            margin-right: 20px;
+
+            &:last-child {
+                margin-right: 0;
+            }
+
+            .label {
+                margin-right: 10px;
+            }
+        }
+    }
+
+    .fAd_content {
+        flex: 1;
+    }
+
+    .fAd_footer {
+        background: #F2F2F2;
+        padding: 10px 20px;
+        display: flex;
+        justify-content: flex-end;
+    }
+}
+</style>

+ 5 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -1472,6 +1472,11 @@
                 }
                 this.exportParam.dateRange = this.dateRange;
             }
+            if(this.$route.query && this.$route.query.endDate && this.$route.query.startDate) {
+                const { endDate, startDate } = this.$route.query
+                const lastDay = this.dayjs(`${endDate}-01`).endOf('month').format('YYYY-MM-DD');
+                this.dateRange = [startDate+'-01', lastDay];
+            }
             this.radio = this.$t('other.project')
             this.getEchart();
             var _this = this;