From 9dc0df5868d2fe07aaae4e232134dda3b1f6db76 Mon Sep 17 00:00:00 2001 From: siontion Date: Mon, 8 Jul 2024 14:20:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=91=98=E5=B7=A5=E5=B7=A5=E8=B5=84?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E3=80=91DB=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/biz/enums/ErrorCodeConstants.java | 2 + .../salarymonth/SalaryMonthController.java | 103 ++++++++++++ .../salarymonth/vo/SalaryMonthPageReqVO.java | 104 ++++++++++++ .../salarymonth/vo/SalaryMonthRespVO.java | 129 ++++++++++++++ .../salarymonth/vo/SalaryMonthSaveReqVO.java | 97 +++++++++++ .../dataobject/salarymonth/SalaryMonthDO.java | 157 ++++++++++++++++++ .../mysql/salarymonth/SalaryMonthMapper.java | 53 ++++++ .../salarymonth/SalaryMonthService.java | 62 +++++++ .../salarymonth/SalaryMonthServiceImpl.java | 87 ++++++++++ .../mapper/salarymonth/SalaryMonthMapper.xml | 12 ++ .../dal/dataobject/user/AdminUserDO.java | 72 ++++++++ .../dal/mysql/user/AdminUserMapper.java | 4 + sql/v1.0.0/2.business/1.structure.sql | 44 ++++- 13 files changed, 923 insertions(+), 3 deletions(-) create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/SalaryMonthController.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthPageReqVO.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthRespVO.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthSaveReqVO.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/dataobject/salarymonth/SalaryMonthDO.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/mysql/salarymonth/SalaryMonthMapper.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthService.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthServiceImpl.java create mode 100644 mes-module-majoys/mes-module-majoys-biz/src/main/resources/mapper/salarymonth/SalaryMonthMapper.xml diff --git a/mes-module-majoys/mes-module-majoys-api/src/main/java/com/chanko/yunxi/mes/module/biz/enums/ErrorCodeConstants.java b/mes-module-majoys/mes-module-majoys-api/src/main/java/com/chanko/yunxi/mes/module/biz/enums/ErrorCodeConstants.java index 71a049ec..8313a5cd 100644 --- a/mes-module-majoys/mes-module-majoys-api/src/main/java/com/chanko/yunxi/mes/module/biz/enums/ErrorCodeConstants.java +++ b/mes-module-majoys/mes-module-majoys-api/src/main/java/com/chanko/yunxi/mes/module/biz/enums/ErrorCodeConstants.java @@ -123,4 +123,6 @@ public interface ErrorCodeConstants { ErrorCode CURRENT_STOCK_NOT_EXISTS = new ErrorCode(1_014_001, "t用友T+库存(现存货)不存在"); /*************包装管理*************/ ErrorCode SALE_ORDER_PACKING_CLAUSE_NOT_EXISTS = new ErrorCode(1_015_001, "生产订单包装规则不存在"); + /*************财务报表*************/ + ErrorCode SALARY_MONTH_NOT_EXISTS = new ErrorCode(1_016_001, "所属年月工资明细不存在"); } diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/SalaryMonthController.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/SalaryMonthController.java new file mode 100644 index 00000000..eefd71fb --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/SalaryMonthController.java @@ -0,0 +1,103 @@ +package com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo.*; +import com.chanko.yunxi.mes.module.biz.dal.dataobject.salarymonth.SalaryMonthDO; +import com.chanko.yunxi.mes.module.biz.service.salarymonth.SalaryMonthService; + +@Tag(name = "管理后台 - 所属年月工资明细") +@RestController +@RequestMapping("/biz/salary-month") +@Validated +public class SalaryMonthController { + + @Resource + private SalaryMonthService salaryMonthService; + + @PostMapping("/save") + @Operation(summary = "保存所属年月工资明细") + @PreAuthorize("@ss.hasPermission('biz:salary-month:create')") + public CommonResult saveSalaryMonth(@Valid @RequestBody SalaryMonthSaveReqVO updateReqVO) { + salaryMonthService.saveSalaryMonth(updateReqVO); + return success(true); + } + + @PostMapping("/create") + @Operation(summary = "创建所属年月工资明细") + @PreAuthorize("@ss.hasPermission('biz:salary-month:create')") + public CommonResult createSalaryMonth(@Valid @RequestBody SalaryMonthSaveReqVO createReqVO) { + return success(salaryMonthService.createSalaryMonth(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新所属年月工资明细") + @PreAuthorize("@ss.hasPermission('biz:salary-month:update')") + public CommonResult updateSalaryMonth(@Valid @RequestBody SalaryMonthSaveReqVO updateReqVO) { + salaryMonthService.updateSalaryMonth(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除所属年月工资明细") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('biz:salary-month:delete')") + public CommonResult deleteSalaryMonth(@RequestParam("id") Long id) { + salaryMonthService.deleteSalaryMonth(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得所属年月工资明细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('biz:salary-month:query')") + public CommonResult getSalaryMonth(@RequestParam("id") Long id) { + SalaryMonthDO salaryMonth = salaryMonthService.getSalaryMonth(id); + return success(BeanUtils.toBean(salaryMonth, SalaryMonthRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得所属年月工资明细分页") + @PreAuthorize("@ss.hasPermission('biz:salary-month:query')") + public CommonResult> getSalaryMonthPage(@Valid SalaryMonthPageReqVO pageReqVO) { + PageResult pageResult = salaryMonthService.getSalaryMonthPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SalaryMonthRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出所属年月工资明细 Excel") + @PreAuthorize("@ss.hasPermission('biz:salary-month:export')") + @OperateLog(type = EXPORT) + public void exportSalaryMonthExcel(@Valid SalaryMonthPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = salaryMonthService.getSalaryMonthPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "所属年月工资明细.xls", "数据", SalaryMonthRespVO.class, + BeanUtils.toBean(list, SalaryMonthRespVO.class)); + } + +} diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthPageReqVO.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthPageReqVO.java new file mode 100644 index 00000000..1c05e514 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthPageReqVO.java @@ -0,0 +1,104 @@ +package com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 所属年月工资明细分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SalaryMonthPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "员工id") + private Long userId; + + @Schema(description = "所属年月") + private String month; + + @Schema(description = "实际出勤天数") + private Integer attendanceDays; + + @Schema(description = "基本工资") + private BigDecimal basicSalary; + + @Schema(description = "职务津贴") + private BigDecimal jobAllowance; + + @Schema(description = "五险一金补贴") + private BigDecimal fiveOneFund; + + @Schema(description = "敬业限制补贴") + private BigDecimal nonCompeteSubsidy; + + @Schema(description = "3天周末加班") + private String weekendWork; + + @Schema(description = "加班小时") + private BigDecimal weekendWorktime; + + @Schema(description = "加班金额") + private BigDecimal weekendWorkAmount; + + @Schema(description = "事假小时") + private BigDecimal absenceTime; + + @Schema(description = "事假金额") + private BigDecimal absenceAmount; + + @Schema(description = "全勤工资") + private BigDecimal fullAttendanceSalary; + + @Schema(description = "工龄奖补助") + private BigDecimal serviceExperienceAward; + + @Schema(description = "夜班/其他补助") + private BigDecimal otherAward; + + @Schema(description = "应发工资") + private BigDecimal grossPay; + + @Schema(description = "扣退休金") + private BigDecimal retireDeduction; + + @Schema(description = "扣医疗金") + private BigDecimal medicalDeduction; + + @Schema(description = "扣失业金") + private BigDecimal unemploymentDeduction; + + @Schema(description = "扣个税") + private BigDecimal taxDeduction; + + @Schema(description = "扣水电费") + private BigDecimal waterElectricityDeduction; + + @Schema(description = "扣餐费") + private BigDecimal foodDeduction; + + @Schema(description = "扣住宿费") + private BigDecimal lodgingDeduction; + + @Schema(description = "扣借款/其他") + private BigDecimal loanDeduction; + + @Schema(description = "补发") + private BigDecimal reissue; + + @Schema(description = "实发工资") + private BigDecimal netSalary; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthRespVO.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthRespVO.java new file mode 100644 index 00000000..32e46567 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthRespVO.java @@ -0,0 +1,129 @@ +package com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 所属年月工资明细 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SalaryMonthRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "员工id") + @ExcelProperty("员工id") + private Long userId; + + @Schema(description = "所属年月") + @ExcelProperty("所属年月") + private String month; + + @Schema(description = "实际出勤天数") + @ExcelProperty("实际出勤天数") + private Integer attendanceDays; + + @Schema(description = "基本工资") + @ExcelProperty("基本工资") + private BigDecimal basicSalary; + + @Schema(description = "职务津贴") + @ExcelProperty("职务津贴") + private BigDecimal jobAllowance; + + @Schema(description = "五险一金补贴") + @ExcelProperty("五险一金补贴") + private BigDecimal fiveOneFund; + + @Schema(description = "敬业限制补贴") + @ExcelProperty("敬业限制补贴") + private BigDecimal nonCompeteSubsidy; + + @Schema(description = "3天周末加班") + @ExcelProperty("3天周末加班") + private String weekendWork; + + @Schema(description = "加班小时") + @ExcelProperty("加班小时") + private BigDecimal weekendWorktime; + + @Schema(description = "加班金额") + @ExcelProperty("加班金额") + private BigDecimal weekendWorkAmount; + + @Schema(description = "事假小时") + @ExcelProperty("事假小时") + private BigDecimal absenceTime; + + @Schema(description = "事假金额") + @ExcelProperty("事假金额") + private BigDecimal absenceAmount; + + @Schema(description = "全勤工资") + @ExcelProperty("全勤工资") + private BigDecimal fullAttendanceSalary; + + @Schema(description = "工龄奖补助") + @ExcelProperty("工龄奖补助") + private BigDecimal serviceExperienceAward; + + @Schema(description = "夜班/其他补助") + @ExcelProperty("夜班/其他补助") + private BigDecimal otherAward; + + @Schema(description = "应发工资") + @ExcelProperty("应发工资") + private BigDecimal grossPay; + + @Schema(description = "扣退休金") + @ExcelProperty("扣退休金") + private BigDecimal retireDeduction; + + @Schema(description = "扣医疗金") + @ExcelProperty("扣医疗金") + private BigDecimal medicalDeduction; + + @Schema(description = "扣失业金") + @ExcelProperty("扣失业金") + private BigDecimal unemploymentDeduction; + + @Schema(description = "扣个税") + @ExcelProperty("扣个税") + private BigDecimal taxDeduction; + + @Schema(description = "扣水电费") + @ExcelProperty("扣水电费") + private BigDecimal waterElectricityDeduction; + + @Schema(description = "扣餐费") + @ExcelProperty("扣餐费") + private BigDecimal foodDeduction; + + @Schema(description = "扣住宿费") + @ExcelProperty("扣住宿费") + private BigDecimal lodgingDeduction; + + @Schema(description = "扣借款/其他") + @ExcelProperty("扣借款/其他") + private BigDecimal loanDeduction; + + @Schema(description = "补发") + @ExcelProperty("补发") + private BigDecimal reissue; + + @Schema(description = "实发工资") + @ExcelProperty("实发工资") + private BigDecimal netSalary; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthSaveReqVO.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthSaveReqVO.java new file mode 100644 index 00000000..7cdf1e54 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/controller/admin/salarymonth/vo/SalaryMonthSaveReqVO.java @@ -0,0 +1,97 @@ +package com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 所属年月工资明细新增/修改 Request VO") +@Data +public class SalaryMonthSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "员工id") + private Long userId; + + @Schema(description = "所属年月") + private String month; + + @Schema(description = "实际出勤天数") + private Integer attendanceDays; + + @Schema(description = "基本工资") + private BigDecimal basicSalary; + + @Schema(description = "职务津贴") + private BigDecimal jobAllowance; + + @Schema(description = "五险一金补贴") + private BigDecimal fiveOneFund; + + @Schema(description = "敬业限制补贴") + private BigDecimal nonCompete_subsidy; + + @Schema(description = "3天周末加班") + private String weekendWork; + + @Schema(description = "加班小时") + private BigDecimal weekendWorktime; + + @Schema(description = "加班金额") + private BigDecimal weekendWorkAmount; + + @Schema(description = "事假小时") + private BigDecimal absenceTime; + + @Schema(description = "事假金额") + private BigDecimal absenceAmount; + + @Schema(description = "全勤工资") + private BigDecimal fullAttendanceSalary; + + @Schema(description = "工龄奖补助") + private BigDecimal serviceExperienceAward; + + @Schema(description = "夜班/其他补助") + private BigDecimal otherAward; + + @Schema(description = "应发工资") + private BigDecimal grossPay; + + @Schema(description = "扣退休金") + private BigDecimal retireDeduction; + + @Schema(description = "扣医疗金") + private BigDecimal medicalDeduction; + + @Schema(description = "扣失业金") + private BigDecimal unemploymentDeduction; + + @Schema(description = "扣个税") + private BigDecimal taxDeduction; + + @Schema(description = "扣水电费") + private BigDecimal waterElectricityDeduction; + + @Schema(description = "扣餐费") + private BigDecimal foodDeduction; + + @Schema(description = "扣住宿费") + private BigDecimal lodgingDeduction; + + @Schema(description = "扣借款/其他") + private BigDecimal loanDeduction; + + @Schema(description = "补发") + private BigDecimal reissue; + + @Schema(description = "实发工资") + private BigDecimal netSalary; + +} diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/dataobject/salarymonth/SalaryMonthDO.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/dataobject/salarymonth/SalaryMonthDO.java new file mode 100644 index 00000000..027ea94b --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/dataobject/salarymonth/SalaryMonthDO.java @@ -0,0 +1,157 @@ +package com.chanko.yunxi.mes.module.biz.dal.dataobject.salarymonth; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 所属年月工资明细 DO + * + * @author 管理员 + */ +@TableName("base_salary_month") +@KeySequence("base_salary_month_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SalaryMonthDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 员工id + */ + private Long userId; + /** + * 所属年月 + */ + private String month; + /** + * 实际出勤天数 + */ + private Integer attendanceDays; + /** + * 基本工资 + */ + private BigDecimal basicSalary; + /** + * 职务津贴 + */ + private BigDecimal jobAllowance; + /** + * 五险一金补贴 + */ + private BigDecimal fiveOneFund; + /** + * 敬业限制补贴 + */ + private BigDecimal nonCompeteSubsidy; + /** + * 3天周末加班 + */ + private String weekendWork; + /** + * 加班小时 + */ + private BigDecimal weekendWorktime; + /** + * 加班金额 + */ + private BigDecimal weekendWorkAmount; + /** + * 事假小时 + */ + private BigDecimal absenceTime; + /** + * 事假金额 + */ + private BigDecimal absenceAmount; + /** + * 全勤工资 + */ + private BigDecimal fullAttendanceSalary; + /** + * 工龄奖补助 + */ + private BigDecimal serviceExperienceAward; + /** + * 夜班/其他补助 + */ + private BigDecimal otherAward; + /** + * 应发工资 + */ + private BigDecimal grossPay; + /** + * 扣退休金 + */ + private BigDecimal retireDeduction; + /** + * 扣医疗金 + */ + private BigDecimal medicalDeduction; + /** + * 扣失业金 + */ + private BigDecimal unemploymentDeduction; + /** + * 扣个税 + */ + private BigDecimal taxDeduction; + /** + * 扣水电费 + */ + private BigDecimal waterElectricityDeduction; + /** + * 扣餐费 + */ + private BigDecimal foodDeduction; + /** + * 扣住宿费 + */ + private BigDecimal lodgingDeduction; + /** + * 扣借款/其他 + */ + private BigDecimal loanDeduction; + /** + * 补发 + */ + private BigDecimal reissue; + /** + * 实发工资 + */ + private BigDecimal netSalary; + +} \ No newline at end of file diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/mysql/salarymonth/SalaryMonthMapper.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/mysql/salarymonth/SalaryMonthMapper.java new file mode 100644 index 00000000..432e8da4 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/dal/mysql/salarymonth/SalaryMonthMapper.java @@ -0,0 +1,53 @@ +package com.chanko.yunxi.mes.module.biz.dal.mysql.salarymonth; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.biz.dal.dataobject.salarymonth.SalaryMonthDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo.*; + +/** + * 所属年月工资明细 Mapper + * + * @author 管理员 + */ +@Mapper +public interface SalaryMonthMapper extends BaseMapperX { + + default PageResult selectPage(SalaryMonthPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SalaryMonthDO::getId, reqVO.getId()) + .eqIfPresent(SalaryMonthDO::getUserId, reqVO.getUserId()) + .eqIfPresent(SalaryMonthDO::getMonth, reqVO.getMonth()) + .eqIfPresent(SalaryMonthDO::getAttendanceDays, reqVO.getAttendanceDays()) + .eqIfPresent(SalaryMonthDO::getBasicSalary, reqVO.getBasicSalary()) + .eqIfPresent(SalaryMonthDO::getJobAllowance, reqVO.getJobAllowance()) + .eqIfPresent(SalaryMonthDO::getFiveOneFund, reqVO.getFiveOneFund()) + .eqIfPresent(SalaryMonthDO::getNonCompeteSubsidy, reqVO.getNonCompeteSubsidy()) + .eqIfPresent(SalaryMonthDO::getWeekendWork, reqVO.getWeekendWork()) + .eqIfPresent(SalaryMonthDO::getWeekendWorktime, reqVO.getWeekendWorktime()) + .eqIfPresent(SalaryMonthDO::getWeekendWorkAmount, reqVO.getWeekendWorkAmount()) + .eqIfPresent(SalaryMonthDO::getAbsenceTime, reqVO.getAbsenceTime()) + .eqIfPresent(SalaryMonthDO::getAbsenceAmount, reqVO.getAbsenceAmount()) + .eqIfPresent(SalaryMonthDO::getFullAttendanceSalary, reqVO.getFullAttendanceSalary()) + .eqIfPresent(SalaryMonthDO::getServiceExperienceAward, reqVO.getServiceExperienceAward()) + .eqIfPresent(SalaryMonthDO::getOtherAward, reqVO.getOtherAward()) + .eqIfPresent(SalaryMonthDO::getGrossPay, reqVO.getGrossPay()) + .eqIfPresent(SalaryMonthDO::getRetireDeduction, reqVO.getRetireDeduction()) + .eqIfPresent(SalaryMonthDO::getMedicalDeduction, reqVO.getMedicalDeduction()) + .eqIfPresent(SalaryMonthDO::getUnemploymentDeduction, reqVO.getUnemploymentDeduction()) + .eqIfPresent(SalaryMonthDO::getTaxDeduction, reqVO.getTaxDeduction()) + .eqIfPresent(SalaryMonthDO::getWaterElectricityDeduction, reqVO.getWaterElectricityDeduction()) + .eqIfPresent(SalaryMonthDO::getFoodDeduction, reqVO.getFoodDeduction()) + .eqIfPresent(SalaryMonthDO::getLodgingDeduction, reqVO.getLodgingDeduction()) + .eqIfPresent(SalaryMonthDO::getLoanDeduction, reqVO.getLoanDeduction()) + .eqIfPresent(SalaryMonthDO::getReissue, reqVO.getReissue()) + .eqIfPresent(SalaryMonthDO::getNetSalary, reqVO.getNetSalary()) + .betweenIfPresent(SalaryMonthDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SalaryMonthDO::getId)); + } + +} \ No newline at end of file diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthService.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthService.java new file mode 100644 index 00000000..d30669d3 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthService.java @@ -0,0 +1,62 @@ +package com.chanko.yunxi.mes.module.biz.service.salarymonth; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo.*; +import com.chanko.yunxi.mes.module.biz.dal.dataobject.salarymonth.SalaryMonthDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 所属年月工资明细 Service 接口 + * + * @author 管理员 + */ +public interface SalaryMonthService { + + /** + * 创建所属年月工资明细 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSalaryMonth(@Valid SalaryMonthSaveReqVO createReqVO); + + /** + * 更新所属年月工资明细 + * + * @param updateReqVO 更新信息 + */ + void updateSalaryMonth(@Valid SalaryMonthSaveReqVO updateReqVO); + + /** + * 保存所属年月工资明细 + * + * @param updateReqVO 更新信息 + */ + void saveSalaryMonth(@Valid SalaryMonthSaveReqVO updateReqVO); + + /** + * 删除所属年月工资明细 + * + * @param id 编号 + */ + void deleteSalaryMonth(Long id); + + /** + * 获得所属年月工资明细 + * + * @param id 编号 + * @return 所属年月工资明细 + */ + SalaryMonthDO getSalaryMonth(Long id); + + /** + * 获得所属年月工资明细分页 + * + * @param pageReqVO 分页查询 + * @return 所属年月工资明细分页 + */ + PageResult getSalaryMonthPage(SalaryMonthPageReqVO pageReqVO); + +} diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthServiceImpl.java b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthServiceImpl.java new file mode 100644 index 00000000..86528dcc --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/java/com/chanko/yunxi/mes/module/biz/service/salarymonth/SalaryMonthServiceImpl.java @@ -0,0 +1,87 @@ +package com.chanko.yunxi.mes.module.biz.service.salarymonth; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.biz.controller.admin.salarymonth.vo.*; +import com.chanko.yunxi.mes.module.biz.dal.dataobject.salarymonth.SalaryMonthDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.biz.dal.mysql.salarymonth.SalaryMonthMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.biz.enums.ErrorCodeConstants.*; + +/** + * 所属年月工资明细 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class SalaryMonthServiceImpl implements SalaryMonthService { + + @Resource + private SalaryMonthMapper salaryMonthMapper; + + @Override + public Long createSalaryMonth(SalaryMonthSaveReqVO createReqVO) { + // 插入 + SalaryMonthDO salaryMonth = BeanUtils.toBean(createReqVO, SalaryMonthDO.class); + salaryMonthMapper.insert(salaryMonth); + // 返回 + return salaryMonth.getId(); + } + + @Override + public void updateSalaryMonth(SalaryMonthSaveReqVO updateReqVO) { + // 校验存在 + validateSalaryMonthExists(updateReqVO.getId()); + // 更新 + SalaryMonthDO updateObj = BeanUtils.toBean(updateReqVO, SalaryMonthDO.class); + salaryMonthMapper.updateById(updateObj); + } + + @Override + public void saveSalaryMonth(SalaryMonthSaveReqVO updateReqVO) { + SalaryMonthDO salaryMonth = salaryMonthMapper.selectOne(SalaryMonthDO::getUserId,updateReqVO.getUserId(),SalaryMonthDO::getMonth,updateReqVO.getMonth()); + + if(salaryMonth == null){ + // 插入 + salaryMonthMapper.insert(BeanUtils.toBean(updateReqVO, SalaryMonthDO.class)); + }else{ + // 更新 + salaryMonthMapper.updateById(BeanUtils.toBean(updateReqVO, SalaryMonthDO.class)); + } + } + + @Override + public void deleteSalaryMonth(Long id) { + // 校验存在 + validateSalaryMonthExists(id); + // 删除 + salaryMonthMapper.deleteById(id); + } + + private void validateSalaryMonthExists(Long id) { + if (salaryMonthMapper.selectById(id) == null) { + throw exception(SALARY_MONTH_NOT_EXISTS); + } + } + + @Override + public SalaryMonthDO getSalaryMonth(Long id) { + return salaryMonthMapper.selectById(id); + } + + @Override + public PageResult getSalaryMonthPage(SalaryMonthPageReqVO pageReqVO) { + return salaryMonthMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-module-majoys/mes-module-majoys-biz/src/main/resources/mapper/salarymonth/SalaryMonthMapper.xml b/mes-module-majoys/mes-module-majoys-biz/src/main/resources/mapper/salarymonth/SalaryMonthMapper.xml new file mode 100644 index 00000000..28f16917 --- /dev/null +++ b/mes-module-majoys/mes-module-majoys-biz/src/main/resources/mapper/salarymonth/SalaryMonthMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/user/AdminUserDO.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/user/AdminUserDO.java index b9c4a942..4627c26c 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/user/AdminUserDO.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/user/AdminUserDO.java @@ -109,4 +109,76 @@ public class AdminUserDO extends TenantBaseDO { @TableField(exist = false) private BigDecimal salary; + @TableField(exist = false) + private Integer attendanceDays; + + @TableField(exist = false) + private BigDecimal basicSalary; + + @TableField(exist = false) + private BigDecimal jobAllowance; + + @TableField(exist = false) + private BigDecimal fiveOneFund; + + @TableField(exist = false) + private BigDecimal nonCompete_subsidy; + + @TableField(exist = false) + private String weekendWork; + + @TableField(exist = false) + private BigDecimal weekendWorktime; + + @TableField(exist = false) + private BigDecimal weekendWorkAmount; + + @TableField(exist = false) + private BigDecimal absenceTime; + + @TableField(exist = false) + private BigDecimal absenceAmount; + + @TableField(exist = false) + private BigDecimal fullAttendanceSalary; + + @TableField(exist = false) + private BigDecimal serviceExperienceAward; + + @TableField(exist = false) + private BigDecimal otherAward; + + @TableField(exist = false) + private BigDecimal grossPay; + + @TableField(exist = false) + private BigDecimal retireDeduction; + + @TableField(exist = false) + private BigDecimal medicalDeduction; + + @TableField(exist = false) + private BigDecimal unemploymentDeduction; + + @TableField(exist = false) + private BigDecimal taxDeduction; + + @TableField(exist = false) + private BigDecimal waterElectricityDeduction; + + @TableField(exist = false) + private BigDecimal foodDeduction; + + @TableField(exist = false) + private BigDecimal lodgingDeduction; + + @TableField(exist = false) + private BigDecimal loanDeduction; + + @TableField(exist = false) + private BigDecimal reissue; + + @TableField(exist = false) + private BigDecimal netSalary; + } diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java index 6327d800..5b92b328 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/mysql/user/AdminUserMapper.java @@ -113,6 +113,9 @@ public interface AdminUserMapper extends BaseMapperX { "then (select standard_labour_price from base_procedure where id=b.procedure_id and salary_type='PieceRateWage' limit 1)*b.amount " + "else 0 end " + "),0) salary ") + .select("sm.attendance_days,sm.basic_salary,sm.job_allowance,sm.five_one_fund,sm.non_compete_subsidy,sm.weekend_work,sm.weekend_worktime,sm.weekend_work_amount") + .select("sm.absence_time,sm.absence_amount,sm.full_attendance_salary,sm.service_experience_award,sm.other_award,sm.gross_pay,sm.retire_deduction") + .select("sm.medical_deduction,sm.unemployment_deduction,sm.tax_deduction,sm.water_electricity_deduction,sm.food_deduction,sm.lodging_deduction,sm.loan_deduction,sm.reissue,sm.net_salary") .leftJoin("(select * from system_users as a,(SELECT DATE_FORMAT(DATE_SUB(CURRENT_DATE(),INTERVAL "+span+" MONTH) , '%Y%m') year_mont) as b " + ") as a on t.id=a.id") .leftJoin("(" + @@ -122,6 +125,7 @@ public interface AdminUserMapper extends BaseMapperX { "group by ptr.owner,DATE_FORMAT(ptr.report_time, '%Y%m'),pso.code,pso.business_dept_id,ptr.procedure_id,pso.external_code " + ") b on t.id=b.owner and a.id=b.owner and a.year_mont=b.year_mont ") .leftJoin("system_dept as sd on b.business_dept_id= sd.id ") + .leftJoin("base_salary_month as sm on sm.user_id=t.id and sm.month=a.year_mont") .groupBy("t.id,t.username,t.nickname,a.year_mont,b.projectCode,b.external_code,sd.name ") ; query.like(!StringUtils.isEmpty(reqVO.getProjectCode()),"b.projectCode",reqVO.getProjectCode()) diff --git a/sql/v1.0.0/2.business/1.structure.sql b/sql/v1.0.0/2.business/1.structure.sql index fabe2e1d..d43ebe7a 100644 --- a/sql/v1.0.0/2.business/1.structure.sql +++ b/sql/v1.0.0/2.business/1.structure.sql @@ -148,7 +148,7 @@ ALTER TABLE pro_task_report ADD COLUMN `assemble_code` VARCHAR(32) COMMENT '包 DROP TABLE IF EXISTS `sc_equipment`; CREATE TABLE `sc_equipment` ( `Id` int(11) NOT NULL COMMENT '设备id', - `Nmae` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '设备名称', + `Nmae` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL COMMENT '设备名称', `OEE` decimal(24, 2) NULL DEFAULT NULL COMMENT 'OEE', `UtilizationRate` decimal(24, 2) NULL DEFAULT NULL COMMENT '设备利用率', `QualificationRate` decimal(24, 2) NULL DEFAULT NULL COMMENT '产品合格率', @@ -273,7 +273,7 @@ CREATE TABLE `pro_task_dispatch_detail_owner` ( `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', - `owner_ids` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '多个负责人', + `owner_ids` varchar(128) DEFAULT NULL COMMENT '多个负责人', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB COMMENT='派工明细表'; @@ -375,4 +375,42 @@ CREATE TABLE `project_sale_order_packing_clause_detail` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', PRIMARY KEY (`id`) -) ENGINE=InnoDB COMMENT='生产订单包装规则明细表'; \ No newline at end of file +) ENGINE=InnoDB COMMENT='生产订单包装规则明细表'; + + +CREATE TABLE `base_salary_month` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增字段,唯一', + `user_id` bigint(20) DEFAULT NULL COMMENT '员工id', + `month` varchar(10) DEFAULT NULL COMMENT '所属年月', + `attendance_days` int(11) DEFAULT NULL COMMENT '实际出勤天数', + `basic_salary` decimal(10,2) DEFAULT NULL COMMENT '基本工资', + `job_allowance` decimal(10,2) DEFAULT NULL COMMENT '职务津贴', + `five_one_fund` decimal(10,2) DEFAULT NULL COMMENT '五险一金补贴', + `non_compete_subsidy` decimal(10,2) DEFAULT NULL COMMENT '敬业限制补贴', + `weekend_work` varchar(255) DEFAULT NULL COMMENT '3天周末加班', + `weekend_worktime` datetime DEFAULT NULL COMMENT '加班小时', + `weekend_work_amount` decimal(10,2) DEFAULT NULL COMMENT '加班金额', + `absence_time` int(10) DEFAULT NULL COMMENT '事假小时', + `absence_amount` decimal(10,2) DEFAULT NULL COMMENT '事假金额', + `full_attendance_salary` decimal(10,2) DEFAULT NULL COMMENT '全勤工资', + `service_experience_award` decimal(10,2) DEFAULT NULL COMMENT '工龄奖补助', + `other_award` decimal(10,2) DEFAULT NULL COMMENT '夜班/其他补助', + `gross_pay` decimal(10,2) DEFAULT NULL COMMENT '应发工资', + `retire_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣退休金', + `medical_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣医疗金', + `unemployment_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣失业金', + `tax_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣个税', + `water_electricity_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣水电费', + `food_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣餐费', + `lodging_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣住宿费', + `loan_deduction` decimal(10,2) DEFAULT NULL COMMENT '扣借款/其他', + `reissue` decimal(10,2) DEFAULT NULL COMMENT '补发', + `net_salary` decimal(10,2) DEFAULT NULL COMMENT '实发工资', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB COMMENT='所属年月工资明细表'; \ No newline at end of file