Browse Source

部门绩效

yzc 1 year ago
parent
commit
b2756e1f8b

+ 398 - 0
hx-sale/src/main/java/com/fjhx/sale/a-json/DeptPerfApi.json

@@ -0,0 +1,398 @@
+{
+  "openapi": "3.0.1",
+  "tags": [
+    {
+      "name": "部门绩效"
+    }
+  ],
+  "paths": {
+    "/deptPerf/list": {
+      "post": {
+        "summary": "列表",
+        "tags": [
+          "部门绩效"
+        ],
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": null,
+                "required": null,
+                "title": null,
+                "properties": null,
+                "items": null
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "成功",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "required": [
+                    "code",
+                    "success",
+                    "msg",
+                    "data"
+                  ],
+                  "title": null,
+                  "properties": {
+                    "code": {
+                      "type": "Integer",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "success": {
+                      "type": "boolean",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "msg": {
+                      "type": "string",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "data": {
+                      "type": "array",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": {
+                        "type": "object",
+                        "required": null,
+                        "title": null,
+                        "properties": {
+                          "id": {
+                            "type": "integer",
+                            "required": null,
+                            "title": "部门绩效",
+                            "properties": null,
+                            "items": null
+                          },
+                          "deptId": {
+                            "type": "integer",
+                            "required": null,
+                            "title": "部门id",
+                            "properties": null,
+                            "items": null
+                          },
+                          "groupId": {
+                            "type": "integer",
+                            "required": null,
+                            "title": "组id",
+                            "properties": null,
+                            "items": null
+                          },
+                          "year": {
+                            "type": "integer",
+                            "required": null,
+                            "title": "年份",
+                            "properties": null,
+                            "items": null
+                          },
+                          "january": {
+                            "type": "number",
+                            "required": null,
+                            "title": "一月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "february": {
+                            "type": "number",
+                            "required": null,
+                            "title": "二月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "march": {
+                            "type": "number",
+                            "required": null,
+                            "title": "三月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "april": {
+                            "type": "number",
+                            "required": null,
+                            "title": "四月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "may": {
+                            "type": "number",
+                            "required": null,
+                            "title": "五月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "june": {
+                            "type": "number",
+                            "required": null,
+                            "title": "六月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "july": {
+                            "type": "number",
+                            "required": null,
+                            "title": "七月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "august": {
+                            "type": "number",
+                            "required": null,
+                            "title": "八月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "september": {
+                            "type": "number",
+                            "required": null,
+                            "title": "九月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "october": {
+                            "type": "number",
+                            "required": null,
+                            "title": "十月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "november": {
+                            "type": "number",
+                            "required": null,
+                            "title": "十一月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "december": {
+                            "type": "number",
+                            "required": null,
+                            "title": "十二月",
+                            "properties": null,
+                            "items": null
+                          },
+                          "createTime": {
+                            "type": "string",
+                            "required": null,
+                            "title": "创建时间",
+                            "properties": null,
+                            "items": null
+                          },
+                          "updateTime": {
+                            "type": "string",
+                            "required": null,
+                            "title": "修改时间",
+                            "properties": null,
+                            "items": null
+                          }
+                        },
+                        "items": null
+                      }
+                    }
+                  },
+                  "items": null
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+    "/deptPerf/edit": {
+      "post": {
+        "summary": "编辑",
+        "tags": [
+          "部门绩效"
+        ],
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "required": null,
+                "title": null,
+                "properties": {
+                  "id": {
+                    "type": "integer",
+                    "required": null,
+                    "title": "部门绩效",
+                    "properties": null,
+                    "items": null
+                  },
+                  "deptId": {
+                    "type": "integer",
+                    "required": null,
+                    "title": "部门id",
+                    "properties": null,
+                    "items": null
+                  },
+                  "groupId": {
+                    "type": "integer",
+                    "required": null,
+                    "title": "组id",
+                    "properties": null,
+                    "items": null
+                  },
+                  "year": {
+                    "type": "integer",
+                    "required": null,
+                    "title": "年份",
+                    "properties": null,
+                    "items": null
+                  },
+                  "january": {
+                    "type": "number",
+                    "required": null,
+                    "title": "一月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "february": {
+                    "type": "number",
+                    "required": null,
+                    "title": "二月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "march": {
+                    "type": "number",
+                    "required": null,
+                    "title": "三月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "april": {
+                    "type": "number",
+                    "required": null,
+                    "title": "四月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "may": {
+                    "type": "number",
+                    "required": null,
+                    "title": "五月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "june": {
+                    "type": "number",
+                    "required": null,
+                    "title": "六月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "july": {
+                    "type": "number",
+                    "required": null,
+                    "title": "七月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "august": {
+                    "type": "number",
+                    "required": null,
+                    "title": "八月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "september": {
+                    "type": "number",
+                    "required": null,
+                    "title": "九月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "october": {
+                    "type": "number",
+                    "required": null,
+                    "title": "十月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "november": {
+                    "type": "number",
+                    "required": null,
+                    "title": "十一月",
+                    "properties": null,
+                    "items": null
+                  },
+                  "december": {
+                    "type": "number",
+                    "required": null,
+                    "title": "十二月",
+                    "properties": null,
+                    "items": null
+                  }
+                },
+                "items": null
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "成功",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "required": [
+                    "code",
+                    "success",
+                    "msg",
+                    "data"
+                  ],
+                  "title": null,
+                  "properties": {
+                    "code": {
+                      "type": "Integer",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "success": {
+                      "type": "boolean",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "msg": {
+                      "type": "string",
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    },
+                    "data": {
+                      "type": null,
+                      "required": null,
+                      "title": null,
+                      "properties": null,
+                      "items": null
+                    }
+                  },
+                  "items": null
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 45 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/dept/DeptPerfController.java

@@ -0,0 +1,45 @@
+package com.fjhx.sale.controller.dept;
+
+import com.fjhx.sale.entity.dept.dto.DeptPerfDto;
+import com.fjhx.sale.entity.dept.vo.DeptPerfVo;
+import com.fjhx.sale.service.dept.DeptPerfService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+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;
+
+/**
+ * <p>
+ * 部门绩效 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@RestController
+@RequestMapping("/deptPerf")
+public class DeptPerfController {
+
+    @Autowired
+    private DeptPerfService deptPerfService;
+
+    /**
+     * 部门绩效列表
+     */
+    @PostMapping("/list")
+    public List<DeptPerfVo> list(@RequestBody DeptPerfDto dto) {
+        return deptPerfService.getList(dto);
+    }
+
+    /**
+     * 部门绩效编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody DeptPerfDto deptPerfDto) {
+        deptPerfService.edit(deptPerfDto);
+    }
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/dept/dto/DeptPerfDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.dept.dto;
+
+import com.fjhx.sale.entity.dept.po.DeptPerf;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 部门绩效新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@Getter
+@Setter
+public class DeptPerfDto extends DeptPerf {
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/dept/dto/DeptPerfSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.dept.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 部门绩效列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@Getter
+@Setter
+public class DeptPerfSelectDto extends BaseSelectDto {
+
+}

+ 98 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/dept/po/DeptPerf.java

@@ -0,0 +1,98 @@
+package com.fjhx.sale.entity.dept.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 部门绩效
+ * </p>
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@Getter
+@Setter
+@TableName("dept_perf")
+public class DeptPerf extends BasePo {
+
+    /**
+     * 部门id
+     */
+    private Long deptId;
+
+    /**
+     * 组id
+     */
+    private Long groupId;
+
+    /**
+     * 年份
+     */
+    private Integer years;
+
+    /**
+     * 一月
+     */
+    private BigDecimal january;
+
+    /**
+     * 二月
+     */
+    private BigDecimal february;
+
+    /**
+     * 三月
+     */
+    private BigDecimal march;
+
+    /**
+     * 四月
+     */
+    private BigDecimal april;
+
+    /**
+     * 五月
+     */
+    private BigDecimal may;
+
+    /**
+     * 六月
+     */
+    private BigDecimal june;
+
+    /**
+     * 七月
+     */
+    private BigDecimal july;
+
+    /**
+     * 八月
+     */
+    private BigDecimal august;
+
+    /**
+     * 九月
+     */
+    private BigDecimal september;
+
+    /**
+     * 十月
+     */
+    private BigDecimal october;
+
+    /**
+     * 十一月
+     */
+    private BigDecimal november;
+
+    /**
+     * 十二月
+     */
+    private BigDecimal december;
+
+}

+ 27 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/dept/vo/DeptPerfVo.java

@@ -0,0 +1,27 @@
+package com.fjhx.sale.entity.dept.vo;
+
+import com.fjhx.sale.entity.dept.po.DeptPerf;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 部门绩效列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@Getter
+@Setter
+public class DeptPerfVo extends DeptPerf {
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 组名称
+     */
+    private String groupName;
+
+}

+ 26 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/dept/DeptPerfMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.sale.mapper.dept;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.dept.dto.DeptPerfDto;
+import com.fjhx.sale.entity.dept.po.DeptPerf;
+import com.fjhx.sale.entity.dept.vo.DeptPerfVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 部门绩效 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-21
+ */
+public interface DeptPerfMapper extends BaseMapper<DeptPerf> {
+
+    /**
+     * 部门绩效列表
+     */
+    List<DeptPerfVo> getList(@Param("dto") DeptPerfDto dto);
+
+}

+ 30 - 0
hx-sale/src/main/java/com/fjhx/sale/service/dept/DeptPerfService.java

@@ -0,0 +1,30 @@
+package com.fjhx.sale.service.dept;
+
+import com.fjhx.sale.entity.dept.dto.DeptPerfDto;
+import com.fjhx.sale.entity.dept.po.DeptPerf;
+import com.fjhx.sale.entity.dept.vo.DeptPerfVo;
+import com.ruoyi.common.core.service.BaseService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 部门绩效 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-21
+ */
+public interface DeptPerfService extends BaseService<DeptPerf> {
+
+    /**
+     * 部门绩效列表
+     */
+    List<DeptPerfVo> getList(DeptPerfDto dto);
+
+    /**
+     * 部门绩效编辑
+     */
+    void edit(DeptPerfDto deptPerfDto);
+
+}

+ 48 - 0
hx-sale/src/main/java/com/fjhx/sale/service/dept/impl/DeptPerfServiceImpl.java

@@ -0,0 +1,48 @@
+package com.fjhx.sale.service.dept.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.utils.Assert;
+import com.fjhx.sale.entity.dept.dto.DeptPerfDto;
+import com.fjhx.sale.entity.dept.po.DeptPerf;
+import com.fjhx.sale.entity.dept.vo.DeptPerfVo;
+import com.fjhx.sale.mapper.dept.DeptPerfMapper;
+import com.fjhx.sale.service.dept.DeptPerfService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 部门绩效 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-21
+ */
+@Service
+public class DeptPerfServiceImpl extends ServiceImpl<DeptPerfMapper, DeptPerf> implements DeptPerfService {
+
+    @Override
+    public List<DeptPerfVo> getList(DeptPerfDto dto) {
+        Assert.notEmpty(dto.getYears(), "年份不能为空!");
+
+        List<DeptPerfVo> list = this.baseMapper.getList(dto);
+        for (DeptPerfVo deptPerfVo : list) {
+            if (ObjectUtil.isEmpty(deptPerfVo.getId())) {
+                deptPerfVo.setId(IdWorker.getId());
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public void edit(DeptPerfDto dto) {
+        Assert.notEmpty(dto.getId(), "Id不能为空!");
+        Assert.notEmpty(dto.getYears(), "年份不能为空!");
+
+        this.saveOrUpdate(dto);
+    }
+
+}

+ 30 - 0
hx-sale/src/main/resources/mapper/dept/DeptPerfMapper.xml

@@ -0,0 +1,30 @@
+<?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.fjhx.sale.mapper.dept.DeptPerfMapper">
+    <select id="getList" resultType="com.fjhx.sale.entity.dept.vo.DeptPerfVo">
+        SELECT dep.id,
+               de.dept_id,
+               de.dept_name,
+               gr.dept_id                      AS groupId,
+               gr.dept_name                    AS groupName,
+               IFNULL(dep.years, #{dto.years}) AS years,
+               IFNULL(dep.january, 0)          AS january,
+               IFNULL(dep.february, 0)         AS february,
+               IFNULL(dep.march, 0)            AS march,
+               IFNULL(dep.april, 0)            AS april,
+               IFNULL(dep.may, 0)              AS may,
+               IFNULL(dep.june, 0)             AS june,
+               IFNULL(dep.july, 0)             AS july,
+               IFNULL(dep.august, 0)           AS august,
+               IFNULL(dep.september, 0)        AS september,
+               IFNULL(dep.october, 0)          AS october,
+               IFNULL(dep.november, 0)         AS november,
+               IFNULL(dep.december, 0)         AS december
+        FROM sys_dept gr
+                 LEFT JOIN sys_dept de ON gr.parent_id = de.dept_id
+                 LEFT JOIN dept_perf dep ON dep.group_id = gr.dept_id AND dep.years = #{dto.years}
+        WHERE gr.parent_id IN (SELECT dept_id FROM sys_dept WHERE type = 2 AND parent_id = 100)
+          AND gr.type = 3
+    </select>
+
+</mapper>