Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev' into dev

phoenix 1 anno fa
parent
commit
d4e03ac6fe

+ 22 - 4
src/main/java/com/xjrsoft/module/personnel/controller/BasePersonnelLabourCapitalController.java

@@ -6,20 +6,20 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
-import com.xjrsoft.module.personnel.dto.AddBasePersonnelLabourCapitalDto;
-import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalPageDto;
-import com.xjrsoft.module.personnel.dto.ImportBasePersonnelLabourCapitalDto;
-import com.xjrsoft.module.personnel.dto.UpdateBasePersonnelLabourCapitalDto;
+import com.xjrsoft.module.personnel.dto.*;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapital;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapitalData;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapitalTitle;
 import com.xjrsoft.module.personnel.service.IBasePersonnelLabourCapitalService;
 import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalPageVo;
 import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalVo;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo;
 import com.xjrsoft.module.weekly.dto.WeeklyDutySchedulePageDto;
 import com.xjrsoft.module.weekly.vo.WeeklyDutyScheduleListVo;
 import com.yomahub.liteflow.util.JsonUtil;
@@ -75,6 +75,24 @@ public class BasePersonnelLabourCapitalController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/monthpage")
+    @ApiOperation(value="手机端月工资条发放列表(分页)")
+    @SaCheckPermission("basepersonnellabourcapital:detail")
+    public RT<PageOutput<BasePersonnelLabourCapitalMonthPageVo>> monthPage(@Valid BasePersonnelLabourCapitalMonthPageDto dto){
+        Page<BasePersonnelLabourCapitalMonthPageVo> page = basePersonnelLabourCapitalService.getMonthPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<BasePersonnelLabourCapitalMonthPageVo> pageOutput = ConventPage.getPageOutput(page, BasePersonnelLabourCapitalMonthPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/yearpage")
+    @ApiOperation(value="手机端年工资条发放列表(分页)")
+    @SaCheckPermission("basepersonnellabourcapital:detail")
+    public RT<PageOutput<BasePersonnelLabourCapitalYearPageVo>> yearPage(@Valid BasePersonnelLabourCapitalYearPageDto dto){
+        Page<BasePersonnelLabourCapitalYearPageVo> page = basePersonnelLabourCapitalService.getYearPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<BasePersonnelLabourCapitalYearPageVo> pageOutput = ConventPage.getPageOutput(page, BasePersonnelLabourCapitalYearPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询工资发放信息")
     @SaCheckPermission("basepersonnellabourcapital:detail")

+ 22 - 0
src/main/java/com/xjrsoft/module/personnel/dto/BasePersonnelLabourCapitalMonthPageDto.java

@@ -0,0 +1,22 @@
+package com.xjrsoft.module.personnel.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @title: 月工资条分页查询入参
+ * @Author brealinxx
+ * @Date: 2024-01-25
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BasePersonnelLabourCapitalMonthPageDto extends PageInput {
+    @ApiModelProperty("年份")
+    public int year;
+
+    @ApiModelProperty("月份")
+    public int month;
+}

+ 22 - 0
src/main/java/com/xjrsoft/module/personnel/dto/BasePersonnelLabourCapitalYearPageDto.java

@@ -0,0 +1,22 @@
+package com.xjrsoft.module.personnel.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @title: 年工资条分页查询入参
+ * @Author brealinxx
+ * @Date: 2024-01-25
+ * @Version 1.0
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BasePersonnelLabourCapitalYearPageDto extends PageInput {
+    @ApiModelProperty("年份")
+    public int year;
+
+    @ApiModelProperty("发放项目")
+    public String project;
+}

+ 15 - 7
src/main/java/com/xjrsoft/module/personnel/mapper/BasePersonnelLabourCapitalMapper.java

@@ -1,16 +1,24 @@
 package com.xjrsoft.module.personnel.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapital;
+import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapitalData;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
-* @title: 工资发放
-* @Author dzx
-* @Date: 2023-11-08
-* @Version 1.0
-*/
+ * @title: 月工资条数据
+ * @Author brealinxx
+ * @Date: 2024-01-25
+ * @Version 1.0
+ */
 @Mapper
-public interface BasePersonnelLabourCapitalMapper extends MPJBaseMapper<BasePersonnelLabourCapital> {
-
+public interface BasePersonnelLabourCapitalMapper extends MPJBaseMapper<BasePersonnelLabourCapital>{
+    Page<BasePersonnelLabourCapitalMonthPageVo> getMonthPage(Page<BasePersonnelLabourCapitalMonthPageDto> page, BasePersonnelLabourCapitalMonthPageDto dto);
+    Page<BasePersonnelLabourCapitalYearPageVo> getYearPage(Page<BasePersonnelLabourCapitalYearPageDto> page, BasePersonnelLabourCapitalYearPageDto dto);
 }
+

+ 10 - 0
src/main/java/com/xjrsoft/module/personnel/service/IBasePersonnelLabourCapitalService.java

@@ -1,7 +1,14 @@
 package com.xjrsoft.module.personnel.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto;
+import com.xjrsoft.module.personnel.dto.LaborManagementPageDto;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapital;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo;
+import com.xjrsoft.module.personnel.vo.LaborManagementPageVo;
 
 import java.util.List;
 
@@ -36,4 +43,7 @@ public interface IBasePersonnelLabourCapitalService extends MPJBaseService<BaseP
     * @return
     */
     Boolean delete(List<Long> ids);
+
+    Page<BasePersonnelLabourCapitalMonthPageVo> getMonthPage(Page<BasePersonnelLabourCapitalMonthPageDto> page, BasePersonnelLabourCapitalMonthPageDto dto);
+    Page<BasePersonnelLabourCapitalYearPageVo> getYearPage(Page<BasePersonnelLabourCapitalYearPageDto> page, BasePersonnelLabourCapitalYearPageDto dto);
 }

+ 43 - 0
src/main/java/com/xjrsoft/module/personnel/service/impl/BasePersonnelLabourCapitalServiceImpl.java

@@ -1,7 +1,12 @@
 package com.xjrsoft.module.personnel.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
+import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapital;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapitalData;
 import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapitalTitle;
@@ -9,11 +14,15 @@ import com.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalDataMapper;
 import com.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalMapper;
 import com.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalTitleMapper;
 import com.xjrsoft.module.personnel.service.IBasePersonnelLabourCapitalService;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo;
+import com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -31,6 +40,40 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
     private final BasePersonnelLabourCapitalDataMapper basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper;
     private final BasePersonnelLabourCapitalTitleMapper basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper;
 
+    @Override
+    public Page<BasePersonnelLabourCapitalMonthPageVo> getMonthPage(Page<BasePersonnelLabourCapitalMonthPageDto> page, BasePersonnelLabourCapitalMonthPageDto dto) {
+        Page<BasePersonnelLabourCapitalMonthPageVo> resultPage = basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.getMonthPage(page, dto);
+
+        for (BasePersonnelLabourCapitalMonthPageVo record : resultPage.getRecords()) {
+            JSONObject extendJsonObj = JSON.parseObject(record.getPendingJson());
+            Map<String, Object> newDict = new HashMap<>();
+
+            for (String key : extendJsonObj.keySet()) {
+                String bpName = getBpName(key);
+                if (bpName != null) {
+                    newDict.put(bpName, extendJsonObj.getString(key));
+                }
+            }
+
+            record.setDict(newDict);
+        }
+
+        return resultPage;
+    }
+
+    @Override
+    public Page<BasePersonnelLabourCapitalYearPageVo> getYearPage(Page<BasePersonnelLabourCapitalYearPageDto> page, BasePersonnelLabourCapitalYearPageDto dto) {
+        return basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.getYearPage(page, dto);
+    }
+
+    private String getBpName(String columnNumber) {
+        List<BasePersonnelLabourCapitalTitle> bpTitles = basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.selectList(Wrappers.<BasePersonnelLabourCapitalTitle>lambdaQuery().eq(BasePersonnelLabourCapitalTitle::getColumnNumber, columnNumber));
+        if (bpTitles != null && !bpTitles.isEmpty()) {
+            return bpTitles.get(0).getName();
+        } else {
+            return null;
+        }
+    }
 
     @Override
     @Transactional(rollbackFor = Exception.class)

+ 58 - 0
src/main/java/com/xjrsoft/module/personnel/vo/BasePersonnelLabourCapitalMonthPageVo.java

@@ -0,0 +1,58 @@
+package com.xjrsoft.module.personnel.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.qiniu.util.Json;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @title: 月工资条分页列表出参
+ * @Author brealinxx
+ * @Date: 2024-01-25
+ * @Version 1.0
+ */
+@Data
+public class BasePersonnelLabourCapitalMonthPageVo {
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键")
+    @ApiModelProperty("主键")
+    private String id;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("姓名")
+    @ApiModelProperty("姓名")
+    private String name;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("部门")
+    @ApiModelProperty("部门")
+    private String dept;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("总计")
+    @ApiModelProperty("总计")
+    private float amount;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("待处理json")
+    @ApiModelProperty("待处理json")
+    private String pendingJson;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("月工资明细")
+    @ApiModelProperty("月工资明细")
+    private Map<String, Object> dict;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("月份")
+    @ApiModelProperty("月份")
+    private int month;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("年份")
+    @ApiModelProperty("年份")
+    private int year;
+}

+ 57 - 0
src/main/java/com/xjrsoft/module/personnel/vo/BasePersonnelLabourCapitalYearPageVo.java

@@ -0,0 +1,57 @@
+package com.xjrsoft.module.personnel.vo;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.qiniu.util.Json;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @title: 年工资条分页列表出参
+ * @Author brealinxx
+ * @Date: 2024-01-25
+ * @Version 1.0
+ */
+@Data
+public class BasePersonnelLabourCapitalYearPageVo {
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("主键")
+    @ApiModelProperty("主键")
+    private String id;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("姓名")
+    @ApiModelProperty("姓名")
+    private String name;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("项目名称")
+    @ApiModelProperty("项目名称")
+    private String project;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("部门")
+    @ApiModelProperty("部门")
+    private String dept;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("月份")
+    @ApiModelProperty("月份")
+    private int month;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("金额")
+    @ApiModelProperty("金额")
+    private float amount;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("月金额")
+    @ApiModelProperty("月金额")
+    private float monthAmount;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("年金额")
+    @ApiModelProperty("年金额")
+    private float yearAmount;
+}

+ 64 - 0
src/main/resources/mapper/personnel/BasePersonnelLabourCapitalMapper.xml

@@ -0,0 +1,64 @@
+<?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.xjrsoft.module.personnel.mapper.BasePersonnelLabourCapitalMapper">
+    <select id="getMonthPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalMonthPageVo">
+        SELECT
+            t.id,
+            YEAR(t.date_of_issue),
+            MONTH(t.date_of_issue),
+            t1.name,
+            d.name as dept,
+            t1.amount_to as amount,
+            t1.extend_json as pendingJson
+        FROM
+            base_personnel_labour_capital t
+                LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id
+                LEFT JOIN xjr_user u ON t1.job_number = u.user_name
+                LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
+                LEFT JOIN xjr_department d ON w.dept_name = d.id
+        WHERE t.delete_mark = 0
+        <if test="dto.year != null and dto.month != null">
+            and YEAR(t.date_of_issue) = #{dto.year}
+            and MONTH(t.date_of_issue) = #{dto.month}
+        </if>
+    </select>
+
+    <select id="getYearPage" parameterType="com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto" resultType="com.xjrsoft.module.personnel.vo.BasePersonnelLabourCapitalYearPageVo">
+        <if test="dto.year != null and dto.project != null">
+        SELECT
+            t.id,
+            t.name,
+            t1.name as project,
+            d.name as dept,
+            month(t1.date_of_issue) as month,
+            t.amount_to as amount,
+            SUM(t.amount_to) OVER (PARTITION BY t.create_user_id, MONTH(t1.date_of_issue)) as monthAmount,
+            (SELECT SUM(amount_to) FROM base_personnel_labour_capital_data WHERE name = t.name) as yearAmount
+        from base_personnel_labour_capital_data t
+                 LEFT JOIN base_personnel_labour_capital t1 ON t.labour_capital_id = t1.id
+                 LEFT JOIN xjr_user u ON t.job_number = u.user_name
+                 LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id
+                 LEFT JOIN xjr_department d ON w.dept_name = d.id
+                 LEFT JOIN base_personnel_labour_capital_title bp ON bp.labour_capital_id = t.id
+        WHERE
+            t.delete_mark = 0
+        and YEAR(t1.date_of_issue) = #{dto.year}
+        and t1.name = #{dto.project}
+        </if>
+    </select>
+</mapper>
+        <!--    SELECT-->
+        <!--    t.id, t1.name, YEAR(DATE(t.date_of_issue)) as issue_year, d.name as dept, t1.amount_to,-->
+        <!--    (SELECT JSON_OBJECTAGG(bp.name, JSON_UNQUOTE(JSON_EXTRACT(t1.extend_json, CONCAT('$."', bp.column_number, '"'))))-->
+        <!--    FROM base_personnel_labour_capital_title bp-->
+        <!--    WHERE bp.labour_capital_id = t.id) as dict-->
+
+        <!--    FROM base_personnel_labour_capital t-->
+        <!--    LEFT JOIN base_personnel_labour_capital_data t1 ON t1.labour_capital_id = t.id-->
+        <!--    LEFT JOIN xjr_user u ON t1.job_number = u.user_name-->
+        <!--    LEFT JOIN wf_teacher_depart w ON u.id = w.create_user_id-->
+        <!--    LEFT JOIN xjr_department d ON w.dept_name = d.id-->
+        <!--    WHERE t.delete_mark = 0-->
+        <!--    AND MONTH(DATE(t.date_of_issue)) = '1';-->