【员工工资明细】DB脚本

dev
siontion 4 months ago
parent 84d7fd2a54
commit 9dc0df5868

@ -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, "所属年月工资明细不存在");
}

@ -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<Boolean> saveSalaryMonth(@Valid @RequestBody SalaryMonthSaveReqVO updateReqVO) {
salaryMonthService.saveSalaryMonth(updateReqVO);
return success(true);
}
@PostMapping("/create")
@Operation(summary = "创建所属年月工资明细")
@PreAuthorize("@ss.hasPermission('biz:salary-month:create')")
public CommonResult<Long> createSalaryMonth(@Valid @RequestBody SalaryMonthSaveReqVO createReqVO) {
return success(salaryMonthService.createSalaryMonth(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新所属年月工资明细")
@PreAuthorize("@ss.hasPermission('biz:salary-month:update')")
public CommonResult<Boolean> 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<Boolean> 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<SalaryMonthRespVO> 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<PageResult<SalaryMonthRespVO>> getSalaryMonthPage(@Valid SalaryMonthPageReqVO pageReqVO) {
PageResult<SalaryMonthDO> 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<SalaryMonthDO> list = salaryMonthService.getSalaryMonthPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "所属年月工资明细.xls", "数据", SalaryMonthRespVO.class,
BeanUtils.toBean(list, SalaryMonthRespVO.class));
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<SalaryMonthDO> {
default PageResult<SalaryMonthDO> selectPage(SalaryMonthPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SalaryMonthDO>()
.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));
}
}

@ -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<SalaryMonthDO> getSalaryMonthPage(SalaryMonthPageReqVO pageReqVO);
}

@ -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<SalaryMonthDO> getSalaryMonthPage(SalaryMonthPageReqVO pageReqVO) {
return salaryMonthMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,12 @@
<?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.chanko.yunxi.mes.module.biz.dal.mysql.salarymonth.SalaryMonthMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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;
}

@ -113,6 +113,9 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
"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<AdminUserDO> {
"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())

@ -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='生产订单包装规则明细表';
) 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='所属年月工资明细表';
Loading…
Cancel
Save