Browse Source

Merge branch 'kd-dev' of https://gitee.com/zhoulisky/kd-cloud into HEAD

# Conflicts:
#	doc/sql/kd_dev.sql
#	kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/TechnicianMapper.java
#	kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/TechnicianMapper.xml
#	kd-service/kd-scientific/src/main/java/org/sky/scientific/service/ISalaryService.java
#	kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/SalaryServiceImpl.java
#	kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/TechnicianServiceImpl.java
zhoulisky 11 months ago
parent
commit
ac1afe3fce

+ 5 - 3
doc/sql/kd_salary.sql

@@ -11,7 +11,7 @@
  Target Server Version : 50741
  File Encoding         : 65001
 
- Date: 18/06/2025 23:05:07
+ Date: 19/06/2025 19:53:49
 */
 
 SET NAMES utf8mb4;
@@ -27,8 +27,8 @@ CREATE TABLE `kd_salary`  (
   `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
   `number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工号',
   `identity_card` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证号码',
-  `year_and_month` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属年月,只需要年份,如2025',
   `department` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部门',
+  `year_and_month` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属年月,只需要年份,如2025',
   `personnel_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '人员类型',
   `average_monthly_salary` decimal(10, 2) NULL DEFAULT NULL COMMENT '上一年度月均工资(元)',
   `pension_insurance` decimal(10, 2) NULL DEFAULT NULL COMMENT '上一年度月均单位承担部分养老保险',
@@ -44,11 +44,13 @@ CREATE TABLE `kd_salary`  (
   `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
   `status` int(11) NULL DEFAULT 1 COMMENT '状态',
   `is_deleted` int(11) NULL DEFAULT 0 COMMENT '是否已删除',
+  `average_monthly_salary_edit` tinyint(1) NULL DEFAULT NULL COMMENT '上一年度月均工资(元),是否修改过,0:否,1:是',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '技术人员工资表' ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 1935631410673958914 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '技术人员工资表' ROW_FORMAT = DYNAMIC;
 
 -- ----------------------------
 -- Records of kd_salary
 -- ----------------------------
+INSERT INTO `kd_salary` VALUES (1935631410673958913, '000000', '张三', 'zhangsan', '430122198901266026', '技术中心', NULL, '研发人员', 8000.00, 100.00, 80.00, 20.00, 60.00, 20.00, 960.00, 1123598821738675201, 1123598813738675201, '2025-06-19 17:31:05', 1123598821738675201, '2025-06-19 17:31:05', 1, 0, NULL);
 
 SET FOREIGN_KEY_CHECKS = 1;

+ 2 - 1
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/dto/TechnicianDTO.java

@@ -4,6 +4,7 @@ package org.sky.scientific.pojo.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import org.sky.core.tool.utils.DateUtil;
+import org.sky.scientific.pojo.entity.TechnicianDetailEntity;
 import org.sky.scientific.pojo.entity.TechnicianEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -20,7 +21,7 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class TechnicianDTO extends TechnicianEntity {
+public class TechnicianDTO extends TechnicianDetailEntity {
 	@Serial
 	private static final long serialVersionUID = 1L;
 

+ 100 - 0
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/TechnicianDetailEntity.java

@@ -0,0 +1,100 @@
+
+package org.sky.scientific.pojo.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.sky.core.mp.base.BaseEntity;
+import org.sky.core.tenant.mp.TenantEntity;
+
+import java.io.Serial;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * 技术人员花名册 实体类
+ *
+ * @author Kd
+ * @since 2025-06-11
+ */
+@Data
+@TableName("kd_technician_detail")
+@Schema(description = "Technician对象")
+@EqualsAndHashCode(callSuper = true)
+public class TechnicianDetailEntity extends TechnicianEntity {
+
+	@Serial
+	private static final long serialVersionUID = 1L;
+
+
+//	@Schema(description = "姓名")
+//	private String name;
+//
+//	@Schema(description = "工号")
+//	private String number;
+//
+//	@Schema(description = "身份证号码")
+//	private String identityCard;
+
+	private Long technicianId;
+
+	@Schema(description = "性别,1:男,2:女")
+	private Integer gender;
+
+	@Schema(description = "出生日期")
+	private LocalDate birthday;
+
+	@Schema(description = "民族")
+	private String ethnic;
+
+	@Schema(description = "所属二级单位")
+	private String secondaryUnit;
+
+	@Schema(description = "部门/科室/项目部")
+	private String department;
+
+	@Schema(description = "岗位职务")
+	private String post;
+
+	@Schema(description = "岗位所在地")
+	private String postLocation;
+
+	@Schema(description = "用工性质")
+	private String nature;
+
+	@Schema(description = "入职时间")
+	private Date hireDate;
+
+	@Schema(description = "最高学历")
+	private String education;
+
+	@Schema(description = "最高学位")
+	private String degree;
+
+	@Schema(description = "最高学历学校")
+	private String schoolName;
+
+	@Schema(description = "最高学历专业名称")
+	private String major;
+
+	@Schema(description = "职称")
+	private String rank;
+
+	@Schema(description = "执业资格")
+	private String practicingRequirement;
+
+	@Schema(description = "参研情况")
+	private String situation;
+
+	@Schema(description = "人员类型")
+	private String personnelType;
+
+	@Schema(description = "所属年月")
+	private String yearAndMonth;
+
+	@Schema(description = "情况说明")
+	private String remark;
+
+}

+ 4 - 93
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/entity/TechnicianEntity.java

@@ -1,6 +1,7 @@
 
 package org.sky.scientific.pojo.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -33,109 +34,19 @@ public class TechnicianEntity extends TenantEntity {
 	 * 姓名
 	 */
 	@Schema(description = "姓名")
+	@TableField("name")
 	private String name;
 	/**
 	 * 工号
 	 */
 	@Schema(description = "工号")
+	@TableField("number")
 	private String number;
 	/**
 	 * 身份证号码
 	 */
 	@Schema(description = "身份证号码")
+	@TableField("identity_card")
 	private String identityCard;
-	/**
-	 * 性别,1:男,2:女
-	 */
-	@Schema(description = "性别,1:男,2:女")
-	private Integer gender;
-	/**
-	 * 出生日期
-	 */
-	@Schema(description = "出生日期")
-	private LocalDate birthday;
-	/**
-	 * 民族
-	 */
-	@Schema(description = "民族")
-	private String ethnic;
-	/**
-	 * 所属二级单位
-	 */
-	@Schema(description = "所属二级单位")
-	private String secondaryUnit;
-	/**
-	 * 部门/科室/项目部
-	 */
-	@Schema(description = "部门/科室/项目部")
-	private String department;
-	/**
-	 * 岗位职务
-	 */
-	@Schema(description = "岗位职务")
-	private String post;
-	/**
-	 * 岗位所在地
-	 */
-	@Schema(description = "岗位所在地")
-	private String postLocation;
-	/**
-	 * 用工性质
-	 */
-	@Schema(description = "用工性质")
-	private String nature;
-	/**
-	 * 入职时间
-	 */
-	@Schema(description = "入职时间")
-	private Date hireDate;
-	/**
-	 * 最高学历
-	 */
-	@Schema(description = "最高学历")
-	private String education;
-	/**
-	 * 最高学位
-	 */
-	@Schema(description = "最高学位")
-	private String degree;
-	/**
-	 * 最高学历学校
-	 */
-	@Schema(description = "最高学历学校")
-	private String schoolName;
-	/**
-	 * 最高学历专业名称
-	 */
-	@Schema(description = "最高学历专业名称")
-	private String major;
-	/**
-	 * 职称
-	 */
-	@Schema(description = "职称")
-	private String rank;
-	/**
-	 * 执业资格
-	 */
-	@Schema(description = "执业资格")
-	private String practicingRequirement;
-	/**
-	 * 参研情况
-	 */
-	@Schema(description = "参研情况")
-	private String situation;
-	/**
-	 * 人员类型
-	 */
-	@Schema(description = "人员类型")
-	private String personnelType;
-	/**
-	 * 所属年月
-	 */
-	@Schema(description = "所属年月")
-	private String yearAndMonth;
-
-	@Schema(description = "情况说明")
-	private String remark;
 
 }

+ 9 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/SalaryController.java

@@ -16,6 +16,8 @@ import org.sky.core.secure.annotation.IsAdmin;
 import org.sky.core.tool.api.R;
 import org.sky.core.tool.utils.DateUtil;
 import org.sky.core.tool.utils.Func;
+import org.sky.scientific.pojo.dto.SalaryDTO;
+import org.sky.scientific.pojo.dto.TechnicianDTO;
 import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -120,4 +122,11 @@ public class SalaryController extends KdController {
 		ExcelUtil.export(response, "技术人员工资表数据" + DateUtil.time(), "技术人员工资表数据表", list, SalaryExcel.class);
 	}
 
+	@GetMapping("/fetchLastYearData")
+	@ApiOperationSupport(order = 10)
+	@Operation(summary = "读取上年度工资明细", description = "传入选中的年,比如2025")
+	public R<Boolean> fetchLastYearData(SalaryDTO salary) {
+		return R.status(salaryService.fetchLastYearData(salary));
+	}
+
 }

+ 44 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/TechnicianDetailMapper.java

@@ -0,0 +1,44 @@
+
+package org.sky.scientific.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.sky.core.tenant.annotation.TenantIgnore;
+import org.sky.scientific.excel.TechnicianExcel;
+import org.sky.scientific.pojo.dto.TechnicianDTO;
+import org.sky.scientific.pojo.entity.TechnicianDetailEntity;
+import org.sky.scientific.pojo.entity.TechnicianEntity;
+import org.sky.scientific.pojo.vo.TechnicianVO;
+
+import java.util.List;
+
+/**
+ * 技术人员花名册 Mapper 接口
+ *
+ * @author Kd
+ * @since 2025-06-11
+ */
+public interface TechnicianDetailMapper extends BaseMapper<TechnicianDetailEntity> {
+
+//	/**
+//	 * 自定义分页
+//	 *
+//	 * @param page 分页参数
+//	 * @param technician 查询参数
+//	 * @return List<TechnicianVO>
+//	 */
+	@TenantIgnore
+	List<TechnicianVO> selectTechnicianPage(IPage page, TechnicianDTO technician);
+//
+//	List<TechnicianExcel> exportTechnicianList(@Param("technician") TechnicianDTO technician);
+//
+//
+//	Integer countByDateAndNumberOrIdentityCard(TechnicianEntity technician);
+//
+//	Long countByNumberAndIdentifyCard(String number, String identityCard);
+//
+//	List<TechnicianEntity> selectByYearAndMonth(String yearAndMonth);
+//
+//	Long saveTechnician(TechnicianEntity technician);
+}

+ 156 - 0
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/TechnicianDetailMapper.xml

@@ -0,0 +1,156 @@
+<?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="org.sky.scientific.mapper.TechnicianDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="technicianResultMap" type="org.sky.scientific.pojo.entity.TechnicianDetailEntity">
+        <result column="id" property="id"/>
+        <result column="tenant_id" property="tenantId"/>
+        <result column="name" property="name"/>
+        <result column="number" property="number"/>
+        <result column="identity_card" property="identityCard"/>
+        <result column="gender" property="gender"/>
+        <result column="birthday" property="birthday"/>
+        <result column="ethnic" property="ethnic"/>
+        <result column="secondary_unit" property="secondaryUnit"/>
+        <result column="department" property="department"/>
+        <result column="post" property="post"/>
+        <result column="post_location" property="postLocation"/>
+        <result column="nature" property="nature"/>
+        <result column="hire_date" property="hireDate"/>
+        <result column="education" property="education"/>
+        <result column="degree" property="degree"/>
+        <result column="school_name" property="schoolName"/>
+        <result column="major" property="major"/>
+        <result column="rank" property="rank"/>
+        <result column="practicing_requirement" property="practicingRequirement"/>
+        <result column="situation" property="situation"/>
+        <result column="personnel_type" property="personnelType"/>
+        <result column="year_and_month" property="yearAndMonth"/>
+        <result column="remark" property="remark"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+<!--    <sql id="ba"-->
+
+    <select id="selectTechnicianPage" resultMap="technicianResultMap" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">
+        select t1.name,t1.number,t1.identity_card,t2.*
+        from kd_technician t1
+        left join kd_technician_detail t2 on t1.id = t2.technician_id
+        <if test="technician.yearAndMonth.length()==4">
+            INNER JOIN
+            (
+            SELECT technician_id,MAX( year_and_month ) AS max_month
+            FROM kd_technician_detail
+            WHERE LEFT ( year_and_month, 4 ) = #{technician.yearAndMonth} AND is_deleted = 0
+            GROUP BY technician_id
+            ) t3
+            ON t1.id = t3.technician_id and t2.year_and_month = t3.max_month
+        </if>
+        where t1.is_deleted = 0
+          <if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>
+          <if test="technician.number!=null and technician.number!=''">and name like concat(concat('%', #{technician.number}), '%')</if>
+          <if test="technician.identityCard!=null and technician.identityCard!=''">and identity_card like concat(concat('%', #{technician.identityCard}), '%')</if>
+          <if test="technician.secondaryUnit!=null and technician.secondaryUnit!=''">and secondary_unit like concat(concat('%', #{technician.secondaryUnit}), '%')</if>
+          <if test="technician.department!=null and technician.department!=''">and department like concat(concat('%', #{technician.department}), '%')</if>
+          <if test="technician.post!=null and technician.post!=''">and post like concat(concat('%', #{technician.post}), '%')</if>
+          <if test="technician.postLocation!=null and technician.postLocation!=''">and post_location like concat(concat('%', #{technician.postLocation}), '%')</if>
+          <if test="technician.nature!=null and technician.nature!=''">and nature = #{technician.nature}</if>
+          <if test="technician.education!=null and technician.education!=''">and education = #{technician.education}</if>
+          <if test="technician.degree!=null and technician.degree!=''">and degree = #{technician.degree}</if>
+          <if test="technician.rank!=null and technician.rank!=''">and rank = #{technician.rank}</if>
+          <if test="technician.personnelType!=null and technician.personnelType!=''">and personnel_type = #{technician.personnelType}</if>
+          <if test="technician.situation !=null and technician.situation!=''">and situation = #{technician.situation}</if>
+          <if test="technician.practicingRequirement !=null and technician.practicingRequirement!=''">and practicing_requirement like concat(concat('%', #{technician.practicingRequirement}), '%')</if>
+          <if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>
+          <choose>
+              <when test="technician.yearAndMonth.length()==4">
+                  and LEFT ( year_and_month, 4 ) = #{technician.yearAndMonth}
+              </when>
+              <otherwise>
+                  and LEFT ( year_and_month, 6 ) = #{technician.yearAndMonth}
+              </otherwise>
+          </choose>
+        order by year_and_month asc, t2.id asc
+    </select>
+
+<!--    <select id="exportTechnicianList" resultType="org.sky.scientific.excel.TechnicianExcel" parameterType="org.sky.scientific.pojo.dto.TechnicianDTO">-->
+<!--        select t1.*-->
+<!--        from kd_technician t1-->
+<!--        <if test="technician.yearAndMonth.length()==4">-->
+<!--            INNER JOIN-->
+<!--            (-->
+<!--            SELECT number, identity_card, MAX( year_and_month ) AS max_month-->
+<!--            FROM kd_technician-->
+<!--            WHERE LEFT ( year_and_month, 4 ) = #{technician.yearAndMonth} AND is_deleted = 0-->
+<!--            GROUP BY number, identity_card-->
+<!--            ) t2-->
+<!--            ON t1.number = t2.number  AND t1.identity_card = t2.identity_card AND t1.year_and_month = t2.max_month-->
+<!--        </if>-->
+<!--        where is_deleted = 0-->
+<!--        <if test="technician.name!=null and technician.name!=''">and name like concat(concat('%', #{technician.name}), '%')</if>-->
+<!--        <if test="technician.number!=null and technician.number!=''">and name like concat(concat('%', #{technician.number}), '%')</if>-->
+<!--        <if test="technician.identityCard!=null and technician.identityCard!=''">and identity_card like concat(concat('%', #{technician.identityCard}), '%')</if>-->
+<!--        <if test="technician.secondaryUnit!=null and technician.secondaryUnit!=''">and secondary_unit like concat(concat('%', #{technician.secondaryUnit}), '%')</if>-->
+<!--        <if test="technician.department!=null and technician.department!=''">and department like concat(concat('%', #{technician.department}), '%')</if>-->
+<!--        <if test="technician.post!=null and technician.post!=''">and post like concat(concat('%', #{technician.post}), '%')</if>-->
+<!--        <if test="technician.postLocation!=null and technician.postLocation!=''">and post_location like concat(concat('%', #{technician.postLocation}), '%')</if>-->
+<!--        <if test="technician.nature!=null and technician.nature!=''">and nature = #{technician.nature}</if>-->
+<!--        <if test="technician.education!=null and technician.education!=''">and education = #{technician.education}</if>-->
+<!--        <if test="technician.degree!=null and technician.degree!=''">and degree = #{technician.degree}</if>-->
+<!--        <if test="technician.rank!=null and technician.rank!=''">and rank = #{technician.rank}</if>-->
+<!--        <if test="technician.personnelType!=null and technician.personnelType!=''">and personnel_type = #{technician.personnelType}</if>-->
+<!--        <if test="technician.situation !=null and technician.situation!=''">and situation = #{technician.situation}</if>-->
+<!--        <if test="technician.practicingRequirement !=null and technician.practicingRequirement!=''">and practicing_requirement like concat(concat('%', #{technician.practicingRequirement}), '%')</if>-->
+<!--        <if test="technician.hireStartDate!=null and technician.hireEndDate!=''">and hire_Date between #{technician.hireStartDate} and #{technician.hireEndDate}</if>-->
+<!--        <choose>-->
+<!--            <when test="technician.yearAndMonth.length()==4">-->
+<!--                and LEFT ( t1.year_and_month, 4 ) = #{technician.yearAndMonth}-->
+<!--            </when>-->
+<!--            <otherwise>-->
+<!--                and LEFT ( t1.year_and_month, 7 ) = #{technician.yearAndMonth}-->
+<!--            </otherwise>-->
+<!--        </choose>-->
+<!--        order by year_and_month asc, id asc-->
+<!--    </select>-->
+
+<!--    <select id="selectByYearAndMonth">-->
+<!--        select * from kd_technician-->
+<!--        where is_deleted = 0 and LEFT(year_and_month,6) = #{yearAndMonth}-->
+
+<!--    </select>-->
+
+<!--    <select id="exportTechnician" resultType="org.sky.scientific.excel.TechnicianExcel">-->
+<!--        SELECT *-->
+<!--        FROM kd_technician ${ew.customSqlSegment}-->
+<!--    </select>-->
+
+<!--    <select id="countByDateAndNumberOrIdentityCard" parameterType="org.sky.scientific.pojo.entity.TechnicianEntity">-->
+<!--        select count(*)-->
+<!--        from kd_technician t-->
+<!--        left join kd_technician_detail d on d.technician_id = t.id-->
+<!--        where d.is_deleted = 0-->
+<!--        <choose>-->
+<!--            <when test="yearAndMonth.length()==4">-->
+<!--                and LEFT(year_and_month,4) = #{yearAndMonth}-->
+<!--            </when>-->
+<!--            <otherwise>-->
+<!--                and LEFT(year_and_month,6) = #{yearAndMonth}-->
+<!--            </otherwise>-->
+<!--        </choose>-->
+<!--        and (number = #{number} or identity_card = #{identityCard})-->
+<!--    </select>-->
+
+<!--    <select id="countByNumberAndIdentifyCard" resultType="java.lang.Long">-->
+<!--        select id-->
+<!--        from kd_technician-->
+<!--        where number = #{number} or identity_card = #{identityCard}-->
+<!--        and is_deleted = 0-->
+<!--    </select>-->
+</mapper>