添加薪资管理

This commit is contained in:
2026-04-08 18:14:10 +08:00
parent 62b5bfb99d
commit 897c690996
56 changed files with 4433 additions and 288 deletions

View File

@@ -0,0 +1,91 @@
package com.gear.oa.controller;
import com.gear.common.annotation.Log;
import com.gear.common.annotation.RepeatSubmit;
import com.gear.common.core.controller.BaseController;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.domain.R;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import com.gear.common.enums.BusinessType;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearReimbursementBo;
import com.gear.oa.domain.vo.GearReimbursementVo;
import com.gear.oa.service.IGearReimbursementService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 报销
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/reimbursement")
public class GearReimbursementController extends BaseController {
private final IGearReimbursementService iGearReimbursementService;
/**
* 查询报销列表
*/
@GetMapping("/list")
public TableDataInfo<GearReimbursementVo> list(GearReimbursementBo bo, PageQuery pageQuery) {
return iGearReimbursementService.queryPageList(bo, pageQuery);
}
/**
* 导出报销列表
*/
@Log(title = "报销", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(GearReimbursementBo bo, HttpServletResponse response) {
List<GearReimbursementVo> list = iGearReimbursementService.queryList(bo);
ExcelUtil.exportExcel(list, "报销", GearReimbursementVo.class, response);
}
/**
* 获取报销详细信息
*/
@GetMapping("/{reimbursementId}")
public R<GearReimbursementVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long reimbursementId) {
return R.ok(iGearReimbursementService.queryById(reimbursementId));
}
/**
* 新增报销
*/
@Log(title = "报销", businessType = BusinessType.INSERT)
@RepeatSubmit
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearReimbursementBo bo) {
return toAjax(iGearReimbursementService.insertByBo(bo));
}
/**
* 修改报销
*/
@Log(title = "报销", businessType = BusinessType.UPDATE)
@RepeatSubmit
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearReimbursementBo bo) {
return toAjax(iGearReimbursementService.updateByBo(bo));
}
/**
* 删除报销
*/
@Log(title = "报销", businessType = BusinessType.DELETE)
@DeleteMapping("/{reimbursementIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] reimbursementIds) {
return toAjax(iGearReimbursementService.deleteWithValidByIds(Arrays.asList(reimbursementIds), true));
}
}

View File

@@ -0,0 +1,81 @@
package com.gear.oa.controller;
import com.gear.common.annotation.Log;
import com.gear.common.annotation.RepeatSubmit;
import com.gear.common.core.controller.BaseController;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.domain.R;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import com.gear.common.enums.BusinessType;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearWageEntryDetailBo;
import com.gear.oa.domain.vo.GearWageEntryDetailVo;
import com.gear.oa.service.IGearWageEntryDetailService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 工资录入明细
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/wageEntryDetail")
public class GearWageEntryDetailController extends BaseController {
private final IGearWageEntryDetailService iGearWageEntryDetailService;
@GetMapping("/list")
public TableDataInfo<GearWageEntryDetailVo> list(GearWageEntryDetailBo bo, PageQuery pageQuery) {
return iGearWageEntryDetailService.queryPageList(bo, pageQuery);
}
@Log(title = "工资录入明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(GearWageEntryDetailBo bo, HttpServletResponse response) {
List<GearWageEntryDetailVo> list = iGearWageEntryDetailService.queryList(bo);
ExcelUtil.exportExcel(list, "工资录入明细", GearWageEntryDetailVo.class, response);
}
@GetMapping("/{detailId}")
public R<GearWageEntryDetailVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long detailId) {
return R.ok(iGearWageEntryDetailService.queryById(detailId));
}
@Log(title = "工资录入明细", businessType = BusinessType.INSERT)
@RepeatSubmit
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearWageEntryDetailBo bo) {
return toAjax(iGearWageEntryDetailService.insertByBo(bo));
}
@Log(title = "工资录入明细", businessType = BusinessType.UPDATE)
@RepeatSubmit
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearWageEntryDetailBo bo) {
return toAjax(iGearWageEntryDetailService.updateByBo(bo));
}
@Log(title = "工资录入明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{detailIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] detailIds) {
return toAjax(iGearWageEntryDetailService.deleteWithValidByIds(Arrays.asList(detailIds), true));
}
@PostMapping("/initDailyWorkers")
public R<Integer> initDailyWorkers(@RequestBody Map<String, Object> payload) {
String entryDate = String.valueOf(payload.get("entryDate"));
Boolean forceReset = payload.get("forceReset") != null && Boolean.parseBoolean(String.valueOf(payload.get("forceReset")));
return R.ok(iGearWageEntryDetailService.initDailyWorkers(entryDate, forceReset));
}
}

View File

@@ -0,0 +1,73 @@
package com.gear.oa.controller;
import com.gear.common.annotation.Log;
import com.gear.common.annotation.RepeatSubmit;
import com.gear.common.core.controller.BaseController;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.domain.R;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import com.gear.common.enums.BusinessType;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearWageMakeupLogBo;
import com.gear.oa.domain.vo.GearWageMakeupLogVo;
import com.gear.oa.service.IGearWageMakeupLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 工资补录日志
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/wageMakeupLog")
public class GearWageMakeupLogController extends BaseController {
private final IGearWageMakeupLogService iGearWageMakeupLogService;
@GetMapping("/list")
public TableDataInfo<GearWageMakeupLogVo> list(GearWageMakeupLogBo bo, PageQuery pageQuery) {
return iGearWageMakeupLogService.queryPageList(bo, pageQuery);
}
@Log(title = "工资补录日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(GearWageMakeupLogBo bo, HttpServletResponse response) {
List<GearWageMakeupLogVo> list = iGearWageMakeupLogService.queryList(bo);
ExcelUtil.exportExcel(list, "工资补录日志", GearWageMakeupLogVo.class, response);
}
@GetMapping("/{logId}")
public R<GearWageMakeupLogVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long logId) {
return R.ok(iGearWageMakeupLogService.queryById(logId));
}
@Log(title = "工资补录日志", businessType = BusinessType.INSERT)
@RepeatSubmit
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearWageMakeupLogBo bo) {
return toAjax(iGearWageMakeupLogService.insertByBo(bo));
}
@Log(title = "工资补录日志", businessType = BusinessType.UPDATE)
@RepeatSubmit
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearWageMakeupLogBo bo) {
return toAjax(iGearWageMakeupLogService.updateByBo(bo));
}
@Log(title = "工资补录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{logIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] logIds) {
return toAjax(iGearWageMakeupLogService.deleteWithValidByIds(Arrays.asList(logIds), true));
}
}

View File

@@ -0,0 +1,73 @@
package com.gear.oa.controller;
import com.gear.common.annotation.Log;
import com.gear.common.annotation.RepeatSubmit;
import com.gear.common.core.controller.BaseController;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.domain.R;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import com.gear.common.enums.BusinessType;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearWageRateConfigBo;
import com.gear.oa.domain.vo.GearWageRateConfigVo;
import com.gear.oa.service.IGearWageRateConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 工资费率配置
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/wageRateConfig")
public class GearWageRateConfigController extends BaseController {
private final IGearWageRateConfigService iGearWageRateConfigService;
@GetMapping("/list")
public TableDataInfo<GearWageRateConfigVo> list(GearWageRateConfigBo bo, PageQuery pageQuery) {
return iGearWageRateConfigService.queryPageList(bo, pageQuery);
}
@Log(title = "工资费率配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(GearWageRateConfigBo bo, HttpServletResponse response) {
List<GearWageRateConfigVo> list = iGearWageRateConfigService.queryList(bo);
ExcelUtil.exportExcel(list, "工资费率配置", GearWageRateConfigVo.class, response);
}
@GetMapping("/{rateId}")
public R<GearWageRateConfigVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long rateId) {
return R.ok(iGearWageRateConfigService.queryById(rateId));
}
@Log(title = "工资费率配置", businessType = BusinessType.INSERT)
@RepeatSubmit
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearWageRateConfigBo bo) {
return toAjax(iGearWageRateConfigService.insertByBo(bo));
}
@Log(title = "工资费率配置", businessType = BusinessType.UPDATE)
@RepeatSubmit
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearWageRateConfigBo bo) {
return toAjax(iGearWageRateConfigService.updateByBo(bo));
}
@Log(title = "工资费率配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{rateIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] rateIds) {
return toAjax(iGearWageRateConfigService.deleteWithValidByIds(Arrays.asList(rateIds), true));
}
}

View File

@@ -0,0 +1,96 @@
package com.gear.oa.controller;
import com.gear.common.annotation.Log;
import com.gear.common.annotation.RepeatSubmit;
import com.gear.common.core.controller.BaseController;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.domain.R;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import com.gear.common.enums.BusinessType;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearWorkerBo;
import com.gear.oa.domain.bo.GearWorkerImportBo;
import com.gear.oa.domain.vo.GearWorkerVo;
import com.gear.oa.service.IGearWorkerService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* 工人管理
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/oa/worker")
public class GearWorkerController extends BaseController {
private final IGearWorkerService iGearWorkerService;
@GetMapping("/list")
public TableDataInfo<GearWorkerVo> list(GearWorkerBo bo, PageQuery pageQuery) {
return iGearWorkerService.queryPageList(bo, pageQuery);
}
@Log(title = "工人管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(GearWorkerBo bo, HttpServletResponse response) {
List<GearWorkerVo> list = iGearWorkerService.queryList(bo);
ExcelUtil.exportExcel(list, "工人管理", GearWorkerVo.class, response);
}
@RequestMapping(value = "/importTemplate", method = {RequestMethod.GET, RequestMethod.POST})
public void importTemplate(HttpServletResponse response) {
ExcelUtil.exportExcel(Collections.singletonList(new GearWorkerImportBo()), "工人导入模板", GearWorkerImportBo.class, response);
}
@Log(title = "工人管理", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public R<String> importData(@RequestPart("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
if (file == null || file.isEmpty()) {
return R.fail("导入文件不能为空");
}
try (InputStream is = file.getInputStream()) {
List<GearWorkerImportBo> list = ExcelUtil.importExcel(is, GearWorkerImportBo.class);
String msg = iGearWorkerService.importByExcel(list, updateSupport);
return R.ok(msg);
}
}
@GetMapping("/{workerId}")
public R<GearWorkerVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long workerId) {
return R.ok(iGearWorkerService.queryById(workerId));
}
@Log(title = "工人管理", businessType = BusinessType.INSERT)
@RepeatSubmit
@PostMapping
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearWorkerBo bo) {
return toAjax(iGearWorkerService.insertByBo(bo));
}
@Log(title = "工人管理", businessType = BusinessType.UPDATE)
@RepeatSubmit
@PutMapping
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearWorkerBo bo) {
return toAjax(iGearWorkerService.updateByBo(bo));
}
@Log(title = "工人管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{workerIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] workerIds) {
return toAjax(iGearWorkerService.deleteWithValidByIds(Arrays.asList(workerIds), true));
}
}

View File

@@ -0,0 +1,69 @@
package com.gear.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 报销对象 gear_reimbursement
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gear_reimbursement")
public class GearReimbursement extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 报销ID
*/
@TableId(value = "reimbursement_id")
private Long reimbursementId;
/**
* 申请人用户ID
*/
private Long applicantId;
/**
* 申请人名称
*/
private String applicantName;
/**
* 附件(OSS ID串逗号分隔)
*/
private String attachmentUrl;
/**
* 上传时间
*/
private Date uploadTime;
/**
* 报销金额
*/
private BigDecimal amount;
/**
* 报销状态0未报销 1已报销
*/
private String reimburseStatus;
/**
* 删除标志0存在 2删除
*/
@TableLogic
private String delFlag;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,79 @@
package com.gear.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 工资录入明细对象 gear_wage_entry_detail
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gear_wage_entry_detail")
public class GearWageEntryDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "detail_id")
private Long detailId;
private Date entryDate;
private Long empId;
private String empName;
/**
* 计费类型1小时工 2计件工 3天工
*/
private String billingType;
private Long rateId;
private String workTypeName;
private String itemName;
private String processName;
private String orderNo;
/**
* 工作量(小时/件数/天数)
*/
private BigDecimal workload;
private BigDecimal unitPrice;
private BigDecimal baseAmount;
private BigDecimal extraAmount;
private String extraReason;
private BigDecimal totalAmount;
/**
* 是否补录0否 1是
*/
private String isMakeup;
private Long sourceDetailId;
private Long makeupResponsibleId;
private String makeupResponsible;
private String makeupReason;
@TableLogic
private String delFlag;
private String remark;
}

View File

@@ -0,0 +1,48 @@
package com.gear.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 工资补录日志对象 gear_wage_makeup_log
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gear_wage_makeup_log")
public class GearWageMakeupLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "log_id")
private Long logId;
private Long detailId;
private Long sourceDetailId;
/**
* 操作类型1新增补录 2修改补录 3撤销补录
*/
private String operationType;
private Date operationDate;
private Long empId;
private Long makeupResponsibleId;
private String makeupResponsible;
private String makeupReason;
@TableLogic
private String delFlag;
private String remark;
}

View File

@@ -0,0 +1,59 @@
package com.gear.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 工资费率配置对象 gear_wage_rate_config
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gear_wage_rate_config")
public class GearWageRateConfig extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "rate_id")
private Long rateId;
private String rateCode;
private String rateName;
/**
* 计费类型1小时工 2计件工 3天工
*/
private String billingType;
private String workTypeName;
private String itemName;
private String processName;
/**
* 日工时制度如8/9仅天工
*/
private BigDecimal workdayHours;
/**
* 小时单价/件单价/日薪
*/
private BigDecimal unitPrice;
/**
* 状态0启用 1停用
*/
private String status;
@TableLogic
private String delFlag;
private String remark;
}

View File

@@ -0,0 +1,45 @@
package com.gear.oa.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 工人主数据对象 gear_worker
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("gear_worker")
public class GearWorker extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "worker_id")
private Long workerId;
private String workerNo;
private String workerName;
private String phone;
/**
* 默认计费类型1小时工 2计件工 3天工
*/
private String defaultBillingType;
private String defaultWorkTypeName;
/**
* 状态0在职 1离职
*/
private String status;
@TableLogic
private String delFlag;
private String remark;
}

View File

@@ -0,0 +1,60 @@
package com.gear.oa.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 报销业务对象 gear_reimbursement
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GearReimbursementBo extends BaseEntity {
/**
* 报销ID
*/
private Long reimbursementId;
/**
* 申请人用户ID
*/
private Long applicantId;
/**
* 申请人名称
*/
private String applicantName;
/**
* 附件(OSS ID串逗号分隔)
*/
private String attachmentUrl;
/**
* 上传时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date uploadTime;
/**
* 报销金额
*/
private BigDecimal amount;
/**
* 报销状态0未报销 1已报销
*/
private String reimburseStatus;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,74 @@
package com.gear.oa.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gear.common.core.domain.BaseEntity;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
* 工资录入明细业务对象 gear_wage_entry_detail
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GearWageEntryDetailBo extends BaseEntity {
@NotNull(message = "明细ID不能为空", groups = {EditGroup.class})
private Long detailId;
@NotNull(message = "业务日期不能为空", groups = {AddGroup.class, EditGroup.class})
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date entryDate;
@NotNull(message = "员工ID不能为空", groups = {AddGroup.class, EditGroup.class})
private Long empId;
private String empName;
@NotBlank(message = "计费类型不能为空", groups = {AddGroup.class, EditGroup.class})
private String billingType;
@NotNull(message = "费率配置不能为空", groups = {AddGroup.class, EditGroup.class})
private Long rateId;
private String workTypeName;
private String itemName;
private String processName;
private String orderNo;
@NotNull(message = "工作量不能为空", groups = {AddGroup.class, EditGroup.class})
private BigDecimal workload;
private BigDecimal unitPrice;
private BigDecimal baseAmount;
private BigDecimal extraAmount;
private String extraReason;
private BigDecimal totalAmount;
private String isMakeup;
private Long sourceDetailId;
private Long makeupResponsibleId;
private String makeupResponsible;
private String makeupReason;
private String remark;
}

View File

@@ -0,0 +1,39 @@
package com.gear.oa.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gear.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 工资补录日志业务对象 gear_wage_makeup_log
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GearWageMakeupLogBo extends BaseEntity {
private Long logId;
private Long detailId;
private Long sourceDetailId;
private String operationType;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date operationDate;
private Long empId;
private Long makeupResponsibleId;
private String makeupResponsible;
private String makeupReason;
private String remark;
}

View File

@@ -0,0 +1,51 @@
package com.gear.oa.domain.bo;
import com.gear.common.core.domain.BaseEntity;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 工资费率配置业务对象 gear_wage_rate_config
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GearWageRateConfigBo extends BaseEntity {
@NotNull(message = "费率ID不能为空", groups = {EditGroup.class})
private Long rateId;
/**
* 费率编码(后端自动生成)
*/
private String rateCode;
@NotBlank(message = "费率名称不能为空", groups = {AddGroup.class, EditGroup.class})
private String rateName;
/**
* 计费类型1小时工 2计件工 3天工
*/
@NotBlank(message = "计费类型不能为空", groups = {AddGroup.class, EditGroup.class})
private String billingType;
private String workTypeName;
private String itemName;
private String processName;
private BigDecimal workdayHours;
@NotNull(message = "单价不能为空", groups = {AddGroup.class, EditGroup.class})
private BigDecimal unitPrice;
private String status;
private String remark;
}

View File

@@ -0,0 +1,37 @@
package com.gear.oa.domain.bo;
import com.gear.common.core.domain.BaseEntity;
import com.gear.common.core.validate.AddGroup;
import com.gear.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 工人主数据业务对象 gear_worker
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class GearWorkerBo extends BaseEntity {
@NotNull(message = "工人ID不能为空", groups = {EditGroup.class})
private Long workerId;
@NotBlank(message = "工号不能为空", groups = {AddGroup.class, EditGroup.class})
private String workerNo;
@NotBlank(message = "姓名不能为空", groups = {AddGroup.class, EditGroup.class})
private String workerName;
private String phone;
private String defaultBillingType;
private String defaultWorkTypeName;
private String status;
private String remark;
}

View File

@@ -0,0 +1,32 @@
package com.gear.oa.domain.bo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 工人工资模板导入对象
*/
@Data
public class GearWorkerImportBo {
@ExcelProperty(value = "工号")
private String workerNo;
@ExcelProperty(value = "姓名")
private String workerName;
@ExcelProperty(value = "手机号")
private String phone;
@ExcelProperty(value = "默认计费类型(1小时工/2计件工/3天工)")
private String defaultBillingType;
@ExcelProperty(value = "默认工种")
private String defaultWorkTypeName;
@ExcelProperty(value = "状态(0在职/1离职)")
private String status;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,68 @@
package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 报销视图对象 gear_reimbursement
*/
@Data
@ExcelIgnoreUnannotated
public class GearReimbursementVo {
/**
* 报销ID
*/
@ExcelProperty(value = "报销ID")
private Long reimbursementId;
/**
* 申请人用户ID
*/
@ExcelProperty(value = "申请人ID")
private Long applicantId;
/**
* 申请人名称
*/
@ExcelProperty(value = "申请人")
private String applicantName;
/**
* 附件(OSS ID串逗号分隔)
*/
@ExcelProperty(value = "附件")
private String attachmentUrl;
/**
* 上传时间
*/
@ExcelProperty(value = "上传时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date uploadTime;
/**
* 报销金额
*/
@ExcelProperty(value = "金额")
private BigDecimal amount;
/**
* 报销状态0未报销 1已报销
*/
@ExcelProperty(value = "报销状态")
private String reimburseStatus;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,80 @@
package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 工资录入明细视图对象 gear_wage_entry_detail
*/
@Data
@ExcelIgnoreUnannotated
public class GearWageEntryDetailVo {
@ExcelProperty(value = "明细ID")
private Long detailId;
@ExcelProperty(value = "业务日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date entryDate;
@ExcelProperty(value = "员工ID")
private Long empId;
@ExcelProperty(value = "员工姓名")
private String empName;
@ExcelProperty(value = "计费类型")
private String billingType;
@ExcelProperty(value = "费率配置ID")
private Long rateId;
@ExcelProperty(value = "工种")
private String workTypeName;
@ExcelProperty(value = "加工物品")
private String itemName;
@ExcelProperty(value = "工序")
private String processName;
@ExcelProperty(value = "订单号")
private String orderNo;
@ExcelProperty(value = "工作量")
private BigDecimal workload;
@ExcelProperty(value = "单价")
private BigDecimal unitPrice;
@ExcelProperty(value = "基础金额")
private BigDecimal baseAmount;
@ExcelProperty(value = "额外金额")
private BigDecimal extraAmount;
@ExcelProperty(value = "额外原因")
private String extraReason;
@ExcelProperty(value = "总金额")
private BigDecimal totalAmount;
@ExcelProperty(value = "是否补录")
private String isMakeup;
@ExcelProperty(value = "补录责任人")
private String makeupResponsible;
@ExcelProperty(value = "补录原因")
private String makeupReason;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,49 @@
package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 工资补录日志视图对象 gear_wage_makeup_log
*/
@Data
@ExcelIgnoreUnannotated
public class GearWageMakeupLogVo {
@ExcelProperty(value = "日志ID")
private Long logId;
@ExcelProperty(value = "补录后明细ID")
private Long detailId;
@ExcelProperty(value = "补录前明细ID")
private Long sourceDetailId;
@ExcelProperty(value = "操作类型")
private String operationType;
@ExcelProperty(value = "补录目标日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date operationDate;
@ExcelProperty(value = "员工ID")
private Long empId;
@ExcelProperty(value = "责任人ID")
private Long makeupResponsibleId;
@ExcelProperty(value = "责任人")
private String makeupResponsible;
@ExcelProperty(value = "补录原因")
private String makeupReason;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,48 @@
package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 工资费率配置视图对象 gear_wage_rate_config
*/
@Data
@ExcelIgnoreUnannotated
public class GearWageRateConfigVo {
@ExcelProperty(value = "费率ID")
private Long rateId;
@ExcelProperty(value = "费率编码")
private String rateCode;
@ExcelProperty(value = "费率名称")
private String rateName;
@ExcelProperty(value = "计费类型")
private String billingType;
@ExcelProperty(value = "工种")
private String workTypeName;
@ExcelProperty(value = "加工物品")
private String itemName;
@ExcelProperty(value = "工序")
private String processName;
@ExcelProperty(value = "日工时制度")
private BigDecimal workdayHours;
@ExcelProperty(value = "单价")
private BigDecimal unitPrice;
@ExcelProperty(value = "状态")
private String status;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,37 @@
package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* 工人主数据视图对象 gear_worker
*/
@Data
@ExcelIgnoreUnannotated
public class GearWorkerVo {
@ExcelProperty(value = "工人ID")
private Long workerId;
@ExcelProperty(value = "工号")
private String workerNo;
@ExcelProperty(value = "姓名")
private String workerName;
@ExcelProperty(value = "手机号")
private String phone;
@ExcelProperty(value = "默认计费类型")
private String defaultBillingType;
@ExcelProperty(value = "默认工种")
private String defaultWorkTypeName;
@ExcelProperty(value = "状态")
private String status;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -0,0 +1,11 @@
package com.gear.oa.mapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearReimbursement;
import com.gear.oa.domain.vo.GearReimbursementVo;
/**
* 报销Mapper接口
*/
public interface GearReimbursementMapper extends BaseMapperPlus<GearReimbursementMapper, GearReimbursement, GearReimbursementVo> {
}

View File

@@ -0,0 +1,17 @@
package com.gear.oa.mapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearWageEntryDetail;
import com.gear.oa.domain.vo.GearWageEntryDetailVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
/**
* 工资录入明细Mapper接口
*/
public interface GearWageEntryDetailMapper extends BaseMapperPlus<GearWageEntryDetailMapper, GearWageEntryDetail, GearWageEntryDetailVo> {
@Delete("delete from gear_wage_entry_detail where entry_date = #{entryDate}")
int deletePhysicalByEntryDate(@Param("entryDate") java.sql.Date entryDate);
}

View File

@@ -0,0 +1,11 @@
package com.gear.oa.mapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearWageMakeupLog;
import com.gear.oa.domain.vo.GearWageMakeupLogVo;
/**
* 工资补录日志Mapper接口
*/
public interface GearWageMakeupLogMapper extends BaseMapperPlus<GearWageMakeupLogMapper, GearWageMakeupLog, GearWageMakeupLogVo> {
}

View File

@@ -0,0 +1,11 @@
package com.gear.oa.mapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearWageRateConfig;
import com.gear.oa.domain.vo.GearWageRateConfigVo;
/**
* 工资费率配置Mapper接口
*/
public interface GearWageRateConfigMapper extends BaseMapperPlus<GearWageRateConfigMapper, GearWageRateConfig, GearWageRateConfigVo> {
}

View File

@@ -0,0 +1,11 @@
package com.gear.oa.mapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearWorker;
import com.gear.oa.domain.vo.GearWorkerVo;
/**
* 工人主数据Mapper接口
*/
public interface GearWorkerMapper extends BaseMapperPlus<GearWorkerMapper, GearWorker, GearWorkerVo> {
}

View File

@@ -0,0 +1,45 @@
package com.gear.oa.service;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearReimbursementBo;
import com.gear.oa.domain.vo.GearReimbursementVo;
import java.util.Collection;
import java.util.List;
/**
* 报销Service接口
*/
public interface IGearReimbursementService {
/**
* 查询报销
*/
GearReimbursementVo queryById(Long reimbursementId);
/**
* 查询报销列表
*/
TableDataInfo<GearReimbursementVo> queryPageList(GearReimbursementBo bo, PageQuery pageQuery);
/**
* 查询报销列表
*/
List<GearReimbursementVo> queryList(GearReimbursementBo bo);
/**
* 新增报销
*/
Boolean insertByBo(GearReimbursementBo bo);
/**
* 修改报销
*/
Boolean updateByBo(GearReimbursementBo bo);
/**
* 校验并批量删除报销
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,29 @@
package com.gear.oa.service;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearWageEntryDetailBo;
import com.gear.oa.domain.vo.GearWageEntryDetailVo;
import java.util.Collection;
import java.util.List;
/**
* 工资录入明细Service接口
*/
public interface IGearWageEntryDetailService {
GearWageEntryDetailVo queryById(Long detailId);
TableDataInfo<GearWageEntryDetailVo> queryPageList(GearWageEntryDetailBo bo, PageQuery pageQuery);
List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo);
Boolean insertByBo(GearWageEntryDetailBo bo);
Boolean updateByBo(GearWageEntryDetailBo bo);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Integer initDailyWorkers(String entryDate, Boolean forceReset);
}

View File

@@ -0,0 +1,30 @@
package com.gear.oa.service;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearWageEntryDetailBo;
import com.gear.oa.domain.bo.GearWageMakeupLogBo;
import com.gear.oa.domain.vo.GearWageMakeupLogVo;
import java.util.Collection;
import java.util.List;
/**
* 工资补录日志Service接口
*/
public interface IGearWageMakeupLogService {
GearWageMakeupLogVo queryById(Long logId);
TableDataInfo<GearWageMakeupLogVo> queryPageList(GearWageMakeupLogBo bo, PageQuery pageQuery);
List<GearWageMakeupLogVo> queryList(GearWageMakeupLogBo bo);
Boolean insertByBo(GearWageMakeupLogBo bo);
Boolean updateByBo(GearWageMakeupLogBo bo);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Boolean insertMakeupLog(Long detailId, Long sourceDetailId, String operationType, GearWageEntryDetailBo detailBo);
}

View File

@@ -0,0 +1,27 @@
package com.gear.oa.service;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearWageRateConfigBo;
import com.gear.oa.domain.vo.GearWageRateConfigVo;
import java.util.Collection;
import java.util.List;
/**
* 工资费率配置Service接口
*/
public interface IGearWageRateConfigService {
GearWageRateConfigVo queryById(Long rateId);
TableDataInfo<GearWageRateConfigVo> queryPageList(GearWageRateConfigBo bo, PageQuery pageQuery);
List<GearWageRateConfigVo> queryList(GearWageRateConfigBo bo);
Boolean insertByBo(GearWageRateConfigBo bo);
Boolean updateByBo(GearWageRateConfigBo bo);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -0,0 +1,30 @@
package com.gear.oa.service;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearWorkerBo;
import com.gear.oa.domain.bo.GearWorkerImportBo;
import com.gear.oa.domain.vo.GearWorkerVo;
import java.util.Collection;
import java.util.List;
/**
* 工人主数据Service接口
*/
public interface IGearWorkerService {
GearWorkerVo queryById(Long workerId);
TableDataInfo<GearWorkerVo> queryPageList(GearWorkerBo bo, PageQuery pageQuery);
List<GearWorkerVo> queryList(GearWorkerBo bo);
Boolean insertByBo(GearWorkerBo bo);
Boolean updateByBo(GearWorkerBo bo);
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
String importByExcel(List<GearWorkerImportBo> list, Boolean updateSupport);
}

View File

@@ -0,0 +1,98 @@
package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.helper.LoginHelper;
import com.gear.common.utils.StringUtils;
import com.gear.oa.domain.GearReimbursement;
import com.gear.oa.domain.bo.GearReimbursementBo;
import com.gear.oa.domain.vo.GearReimbursementVo;
import com.gear.oa.mapper.GearReimbursementMapper;
import com.gear.oa.service.IGearReimbursementService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
/**
* 报销Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class GearReimbursementServiceImpl implements IGearReimbursementService {
private final GearReimbursementMapper baseMapper;
@Override
public GearReimbursementVo queryById(Long reimbursementId) {
return baseMapper.selectVoById(reimbursementId);
}
@Override
public TableDataInfo<GearReimbursementVo> queryPageList(GearReimbursementBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GearReimbursement> lqw = buildQueryWrapper(bo);
Page<GearReimbursementVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<GearReimbursementVo> queryList(GearReimbursementBo bo) {
LambdaQueryWrapper<GearReimbursement> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<GearReimbursement> buildQueryWrapper(GearReimbursementBo bo) {
LambdaQueryWrapper<GearReimbursement> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getReimbursementId() != null, GearReimbursement::getReimbursementId, bo.getReimbursementId());
lqw.eq(bo.getApplicantId() != null, GearReimbursement::getApplicantId, bo.getApplicantId());
lqw.like(StringUtils.isNotBlank(bo.getApplicantName()), GearReimbursement::getApplicantName, bo.getApplicantName());
lqw.eq(StringUtils.isNotBlank(bo.getReimburseStatus()), GearReimbursement::getReimburseStatus, bo.getReimburseStatus());
lqw.eq(bo.getAmount() != null, GearReimbursement::getAmount, bo.getAmount());
lqw.orderByDesc(GearReimbursement::getCreateTime);
return lqw;
}
@Override
public Boolean insertByBo(GearReimbursementBo bo) {
GearReimbursement add = BeanUtil.toBean(bo, GearReimbursement.class);
// 新增时自动回填当前登录人为申请人
if (LoginHelper.getUserId() != null) {
add.setApplicantId(LoginHelper.getUserId());
add.setApplicantName(LoginHelper.getNickName());
}
// 新增时状态固定为未报销
add.setReimburseStatus("0");
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setReimbursementId(add.getReimbursementId());
}
return flag;
}
@Override
public Boolean updateByBo(GearReimbursementBo bo) {
GearReimbursement update = BeanUtil.toBean(bo, GearReimbursement.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
private void validEntityBeforeSave(GearReimbursement entity) {
// TODO 可扩展校验逻辑
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
// TODO 可扩展业务校验逻辑
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@@ -0,0 +1,225 @@
package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.helper.LoginHelper;
import com.gear.common.utils.StringUtils;
import com.gear.oa.domain.GearWageEntryDetail;
import com.gear.oa.domain.GearWageRateConfig;
import com.gear.oa.domain.GearWorker;
import com.gear.oa.domain.bo.GearWageEntryDetailBo;
import com.gear.oa.domain.vo.GearWageEntryDetailVo;
import com.gear.oa.mapper.GearWageEntryDetailMapper;
import com.gear.oa.mapper.GearWageRateConfigMapper;
import com.gear.oa.mapper.GearWorkerMapper;
import com.gear.oa.service.IGearWageEntryDetailService;
import com.gear.oa.service.IGearWageMakeupLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
/**
* 工资录入明细Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailService {
private final GearWageEntryDetailMapper baseMapper;
private final IGearWageMakeupLogService iGearWageMakeupLogService;
private final GearWorkerMapper gearWorkerMapper;
private final GearWageRateConfigMapper gearWageRateConfigMapper;
@Override
public GearWageEntryDetailVo queryById(Long detailId) {
return baseMapper.selectVoById(detailId);
}
@Override
public TableDataInfo<GearWageEntryDetailVo> queryPageList(GearWageEntryDetailBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
Page<GearWageEntryDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<GearWageEntryDetail> buildQueryWrapper(GearWageEntryDetailBo bo) {
LambdaQueryWrapper<GearWageEntryDetail> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getDetailId() != null, GearWageEntryDetail::getDetailId, bo.getDetailId());
lqw.eq(bo.getEntryDate() != null, GearWageEntryDetail::getEntryDate, bo.getEntryDate());
lqw.eq(bo.getEmpId() != null, GearWageEntryDetail::getEmpId, bo.getEmpId());
lqw.like(StringUtils.isNotBlank(bo.getEmpName()), GearWageEntryDetail::getEmpName, bo.getEmpName());
lqw.eq(StringUtils.isNotBlank(bo.getBillingType()), GearWageEntryDetail::getBillingType, bo.getBillingType());
lqw.eq(bo.getRateId() != null, GearWageEntryDetail::getRateId, bo.getRateId());
lqw.eq(StringUtils.isNotBlank(bo.getIsMakeup()), GearWageEntryDetail::getIsMakeup, bo.getIsMakeup());
lqw.like(StringUtils.isNotBlank(bo.getOrderNo()), GearWageEntryDetail::getOrderNo, bo.getOrderNo());
lqw.orderByDesc(GearWageEntryDetail::getEntryDate)
.orderByDesc(GearWageEntryDetail::getCreateTime);
return lqw;
}
@Override
public Boolean insertByBo(GearWageEntryDetailBo bo) {
GearWageEntryDetail add = BeanUtil.toBean(bo, GearWageEntryDetail.class);
fillAmountFields(add);
fillMakeupFields(add);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setDetailId(add.getDetailId());
if ("1".equals(add.getIsMakeup())) {
iGearWageMakeupLogService.insertMakeupLog(add.getDetailId(), add.getSourceDetailId(), "1", bo);
}
}
return flag;
}
@Override
public Boolean updateByBo(GearWageEntryDetailBo bo) {
GearWageEntryDetail old = baseMapper.selectById(bo.getDetailId());
GearWageEntryDetail update = BeanUtil.toBean(bo, GearWageEntryDetail.class);
fillAmountFields(update);
fillMakeupFields(update);
validEntityBeforeSave(update);
boolean flag = baseMapper.updateById(update) > 0;
if (flag && "1".equals(update.getIsMakeup())) {
iGearWageMakeupLogService.insertMakeupLog(update.getDetailId(), old == null ? null : old.getDetailId(), "2", bo);
}
return flag;
}
private void fillAmountFields(GearWageEntryDetail entity) {
BigDecimal workload = entity.getWorkload() == null ? BigDecimal.ZERO : entity.getWorkload();
BigDecimal extraAmount = entity.getExtraAmount() == null ? BigDecimal.ZERO : entity.getExtraAmount();
// 小时工/天工默认按1个计量单位计算基础金额1小时或1天
if (("1".equals(entity.getBillingType()) || "3".equals(entity.getBillingType())) && workload.compareTo(BigDecimal.ZERO) <= 0) {
workload = BigDecimal.ONE;
entity.setWorkload(workload);
}
// 小时工/天工优先使用费率配置中的单价;计件工允许前端录入单价
if ("1".equals(entity.getBillingType()) || "3".equals(entity.getBillingType())) {
if (entity.getRateId() != null && entity.getRateId() > 0) {
GearWageRateConfig config = gearWageRateConfigMapper.selectById(entity.getRateId());
if (config != null && config.getUnitPrice() != null) {
entity.setUnitPrice(config.getUnitPrice());
}
if (StringUtils.isBlank(entity.getWorkTypeName()) && config != null) {
entity.setWorkTypeName(config.getRateName());
}
}
}
BigDecimal unitPrice = entity.getUnitPrice() == null ? BigDecimal.ZERO : entity.getUnitPrice();
BigDecimal baseAmount = workload.multiply(unitPrice);
entity.setBaseAmount(baseAmount);
entity.setExtraAmount(extraAmount);
entity.setTotalAmount(baseAmount.add(extraAmount));
}
private void fillMakeupFields(GearWageEntryDetail entity) {
if (!"1".equals(entity.getIsMakeup())) {
entity.setIsMakeup("0");
entity.setSourceDetailId(null);
entity.setMakeupResponsibleId(null);
entity.setMakeupResponsible(null);
entity.setMakeupReason(null);
return;
}
if (entity.getMakeupResponsibleId() == null) {
entity.setMakeupResponsibleId(LoginHelper.getUserId());
}
if (StringUtils.isBlank(entity.getMakeupResponsible())) {
entity.setMakeupResponsible(LoginHelper.getNickName());
}
}
private void validEntityBeforeSave(GearWageEntryDetail entity) {
// 可扩展:按 rate_id 自动回填单价,或校验唯一索引冲突前置提示
if (entity.getUnitPrice() == null) {
entity.setUnitPrice(BigDecimal.ZERO);
}
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public Integer initDailyWorkers(String entryDate, Boolean forceReset) {
java.sql.Date date = java.sql.Date.valueOf(entryDate);
LambdaQueryWrapper<GearWageEntryDetail> dayWrapper = Wrappers.<GearWageEntryDetail>lambdaQuery()
.eq(GearWageEntryDetail::getEntryDate, date);
Long exists = baseMapper.selectCount(dayWrapper);
if (exists != null && exists > 0) {
if (Boolean.TRUE.equals(forceReset)) {
baseMapper.deletePhysicalByEntryDate(date);
} else {
return 0;
}
}
List<GearWorker> workers = gearWorkerMapper.selectList(Wrappers.<GearWorker>lambdaQuery()
.eq(GearWorker::getStatus, "0")
.orderByAsc(GearWorker::getWorkerNo));
int count = 0;
for (GearWorker worker : workers) {
String billingType = StringUtils.isBlank(worker.getDefaultBillingType()) ? "1" : worker.getDefaultBillingType();
GearWageRateConfig rateConfig = gearWageRateConfigMapper.selectOne(Wrappers.<GearWageRateConfig>lambdaQuery()
.eq(GearWageRateConfig::getBillingType, billingType)
.eq(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()), GearWageRateConfig::getRateName, worker.getDefaultWorkTypeName())
.eq(GearWageRateConfig::getStatus, "0")
.last("limit 1"));
Long rateId = rateConfig == null ? 0L : rateConfig.getRateId();
String orderNo = "";
Long existsSame = baseMapper.selectCount(Wrappers.<GearWageEntryDetail>lambdaQuery()
.eq(GearWageEntryDetail::getEntryDate, date)
.eq(GearWageEntryDetail::getEmpId, worker.getWorkerId())
.eq(GearWageEntryDetail::getBillingType, billingType)
.eq(GearWageEntryDetail::getRateId, rateId)
.eq(GearWageEntryDetail::getOrderNo, orderNo));
if (existsSame != null && existsSame > 0) {
continue;
}
GearWageEntryDetail detail = new GearWageEntryDetail();
detail.setEntryDate(date);
detail.setEmpId(worker.getWorkerId());
detail.setEmpName(worker.getWorkerName());
detail.setBillingType(billingType);
detail.setWorkTypeName(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()) ? worker.getDefaultWorkTypeName() : (rateConfig == null ? null : rateConfig.getRateName()));
detail.setRateId(rateId);
detail.setWorkload(BigDecimal.ZERO);
detail.setUnitPrice(rateConfig == null || rateConfig.getUnitPrice() == null ? BigDecimal.ZERO : rateConfig.getUnitPrice());
detail.setBaseAmount(BigDecimal.ZERO);
detail.setExtraAmount(BigDecimal.ZERO);
detail.setTotalAmount(BigDecimal.ZERO);
detail.setIsMakeup("0");
detail.setOrderNo(orderNo);
detail.setRemark("当日名单初始化");
baseMapper.insert(detail);
count++;
}
return count;
}
}

View File

@@ -0,0 +1,94 @@
package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.helper.LoginHelper;
import com.gear.common.utils.StringUtils;
import com.gear.oa.domain.GearWageMakeupLog;
import com.gear.oa.domain.bo.GearWageEntryDetailBo;
import com.gear.oa.domain.bo.GearWageMakeupLogBo;
import com.gear.oa.domain.vo.GearWageMakeupLogVo;
import com.gear.oa.mapper.GearWageMakeupLogMapper;
import com.gear.oa.service.IGearWageMakeupLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
/**
* 工资补录日志Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class GearWageMakeupLogServiceImpl implements IGearWageMakeupLogService {
private final GearWageMakeupLogMapper baseMapper;
@Override
public GearWageMakeupLogVo queryById(Long logId) {
return baseMapper.selectVoById(logId);
}
@Override
public TableDataInfo<GearWageMakeupLogVo> queryPageList(GearWageMakeupLogBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GearWageMakeupLog> lqw = buildQueryWrapper(bo);
Page<GearWageMakeupLogVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<GearWageMakeupLogVo> queryList(GearWageMakeupLogBo bo) {
LambdaQueryWrapper<GearWageMakeupLog> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<GearWageMakeupLog> buildQueryWrapper(GearWageMakeupLogBo bo) {
LambdaQueryWrapper<GearWageMakeupLog> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getLogId() != null, GearWageMakeupLog::getLogId, bo.getLogId());
lqw.eq(bo.getDetailId() != null, GearWageMakeupLog::getDetailId, bo.getDetailId());
lqw.eq(bo.getEmpId() != null, GearWageMakeupLog::getEmpId, bo.getEmpId());
lqw.eq(bo.getOperationDate() != null, GearWageMakeupLog::getOperationDate, bo.getOperationDate());
lqw.eq(StringUtils.isNotBlank(bo.getOperationType()), GearWageMakeupLog::getOperationType, bo.getOperationType());
lqw.eq(bo.getMakeupResponsibleId() != null, GearWageMakeupLog::getMakeupResponsibleId, bo.getMakeupResponsibleId());
lqw.like(StringUtils.isNotBlank(bo.getMakeupResponsible()), GearWageMakeupLog::getMakeupResponsible, bo.getMakeupResponsible());
lqw.orderByDesc(GearWageMakeupLog::getCreateTime);
return lqw;
}
@Override
public Boolean insertByBo(GearWageMakeupLogBo bo) {
GearWageMakeupLog add = BeanUtil.toBean(bo, GearWageMakeupLog.class);
return baseMapper.insert(add) > 0;
}
@Override
public Boolean updateByBo(GearWageMakeupLogBo bo) {
GearWageMakeupLog update = BeanUtil.toBean(bo, GearWageMakeupLog.class);
return baseMapper.updateById(update) > 0;
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public Boolean insertMakeupLog(Long detailId, Long sourceDetailId, String operationType, GearWageEntryDetailBo detailBo) {
GearWageMakeupLog add = new GearWageMakeupLog();
add.setDetailId(detailId);
add.setSourceDetailId(sourceDetailId);
add.setOperationType(operationType);
add.setOperationDate(detailBo.getEntryDate());
add.setEmpId(detailBo.getEmpId());
add.setMakeupResponsibleId(detailBo.getMakeupResponsibleId() != null ? detailBo.getMakeupResponsibleId() : LoginHelper.getUserId());
add.setMakeupResponsible(StringUtils.isNotBlank(detailBo.getMakeupResponsible()) ? detailBo.getMakeupResponsible() : LoginHelper.getNickName());
add.setMakeupReason(detailBo.getMakeupReason());
add.setRemark(detailBo.getRemark());
return baseMapper.insert(add) > 0;
}
}

View File

@@ -0,0 +1,91 @@
package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.utils.StringUtils;
import com.gear.oa.domain.GearWageRateConfig;
import com.gear.oa.domain.bo.GearWageRateConfigBo;
import com.gear.oa.domain.vo.GearWageRateConfigVo;
import com.gear.oa.mapper.GearWageRateConfigMapper;
import com.gear.oa.service.IGearWageRateConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
/**
* 工资费率配置Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class GearWageRateConfigServiceImpl implements IGearWageRateConfigService {
private final GearWageRateConfigMapper baseMapper;
@Override
public GearWageRateConfigVo queryById(Long rateId) {
return baseMapper.selectVoById(rateId);
}
@Override
public TableDataInfo<GearWageRateConfigVo> queryPageList(GearWageRateConfigBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GearWageRateConfig> lqw = buildQueryWrapper(bo);
Page<GearWageRateConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<GearWageRateConfigVo> queryList(GearWageRateConfigBo bo) {
LambdaQueryWrapper<GearWageRateConfig> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<GearWageRateConfig> buildQueryWrapper(GearWageRateConfigBo bo) {
LambdaQueryWrapper<GearWageRateConfig> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getRateId() != null, GearWageRateConfig::getRateId, bo.getRateId());
lqw.eq(StringUtils.isNotBlank(bo.getRateCode()), GearWageRateConfig::getRateCode, bo.getRateCode());
lqw.like(StringUtils.isNotBlank(bo.getRateName()), GearWageRateConfig::getRateName, bo.getRateName());
lqw.eq(StringUtils.isNotBlank(bo.getBillingType()), GearWageRateConfig::getBillingType, bo.getBillingType());
lqw.like(StringUtils.isNotBlank(bo.getWorkTypeName()), GearWageRateConfig::getWorkTypeName, bo.getWorkTypeName());
lqw.like(StringUtils.isNotBlank(bo.getItemName()), GearWageRateConfig::getItemName, bo.getItemName());
lqw.like(StringUtils.isNotBlank(bo.getProcessName()), GearWageRateConfig::getProcessName, bo.getProcessName());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), GearWageRateConfig::getStatus, bo.getStatus());
lqw.orderByDesc(GearWageRateConfig::getCreateTime);
return lqw;
}
@Override
public Boolean insertByBo(GearWageRateConfigBo bo) {
GearWageRateConfig add = BeanUtil.toBean(bo, GearWageRateConfig.class);
// 前端不传rateCode后端自动生成
add.setRateCode("RATE_" + IdUtil.getSnowflakeNextIdStr());
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setRateId(add.getRateId());
}
return flag;
}
@Override
public Boolean updateByBo(GearWageRateConfigBo bo) {
GearWageRateConfig update = BeanUtil.toBean(bo, GearWageRateConfig.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
private void validEntityBeforeSave(GearWageRateConfig entity) {
// 可扩展:按计费类型校验必填字段
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@@ -0,0 +1,127 @@
package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.common.utils.StringUtils;
import com.gear.oa.domain.GearWorker;
import com.gear.oa.domain.bo.GearWorkerBo;
import com.gear.oa.domain.bo.GearWorkerImportBo;
import com.gear.oa.domain.vo.GearWorkerVo;
import com.gear.oa.mapper.GearWorkerMapper;
import com.gear.oa.service.IGearWorkerService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
/**
* 工人主数据Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class GearWorkerServiceImpl implements IGearWorkerService {
private final GearWorkerMapper baseMapper;
@Override
public GearWorkerVo queryById(Long workerId) {
return baseMapper.selectVoById(workerId);
}
@Override
public TableDataInfo<GearWorkerVo> queryPageList(GearWorkerBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<GearWorker> lqw = buildQueryWrapper(bo);
Page<GearWorkerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public List<GearWorkerVo> queryList(GearWorkerBo bo) {
LambdaQueryWrapper<GearWorker> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<GearWorker> buildQueryWrapper(GearWorkerBo bo) {
LambdaQueryWrapper<GearWorker> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getWorkerId() != null, GearWorker::getWorkerId, bo.getWorkerId());
lqw.eq(StringUtils.isNotBlank(bo.getWorkerNo()), GearWorker::getWorkerNo, bo.getWorkerNo());
lqw.like(StringUtils.isNotBlank(bo.getWorkerName()), GearWorker::getWorkerName, bo.getWorkerName());
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), GearWorker::getPhone, bo.getPhone());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), GearWorker::getStatus, bo.getStatus());
lqw.orderByDesc(GearWorker::getCreateTime);
return lqw;
}
@Override
public Boolean insertByBo(GearWorkerBo bo) {
GearWorker add = BeanUtil.toBean(bo, GearWorker.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setWorkerId(add.getWorkerId());
}
return flag;
}
@Override
public Boolean updateByBo(GearWorkerBo bo) {
GearWorker update = BeanUtil.toBean(bo, GearWorker.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
private void validEntityBeforeSave(GearWorker entity) {
if (StringUtils.isBlank(entity.getStatus())) {
entity.setStatus("0");
}
if (StringUtils.isBlank(entity.getDefaultBillingType())) {
entity.setDefaultBillingType("1");
}
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public String importByExcel(List<GearWorkerImportBo> list, Boolean updateSupport) {
if (list == null || list.isEmpty()) {
return "导入数据为空";
}
int success = 0;
int fail = 0;
StringBuilder msg = new StringBuilder();
for (GearWorkerImportBo item : list) {
if (StringUtils.isBlank(item.getWorkerNo()) || StringUtils.isBlank(item.getWorkerName())) {
fail++;
msg.append("[工号/姓名为空]");
continue;
}
GearWorker exist = baseMapper.selectOne(Wrappers.<GearWorker>lambdaQuery()
.eq(GearWorker::getWorkerNo, item.getWorkerNo()));
if (exist == null) {
GearWorker add = BeanUtil.toBean(item, GearWorker.class);
validEntityBeforeSave(add);
baseMapper.insert(add);
success++;
} else if (Boolean.TRUE.equals(updateSupport)) {
GearWorker update = BeanUtil.toBean(item, GearWorker.class);
update.setWorkerId(exist.getWorkerId());
validEntityBeforeSave(update);
baseMapper.updateById(update);
success++;
} else {
fail++;
msg.append("[工号重复:").append(item.getWorkerNo()).append("]");
}
}
return "导入完成,成功" + success + "条,失败" + fail + "" + (msg.length() > 0 ? "" + msg : "");
}
}

View File

@@ -0,0 +1,37 @@
<?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.gear.oa.mapper.GearWageEntryDetailMapper">
<resultMap type="com.gear.oa.domain.GearWageEntryDetail" id="GearWageEntryDetailResult">
<result property="detailId" column="detail_id"/>
<result property="entryDate" column="entry_date"/>
<result property="empId" column="emp_id"/>
<result property="empName" column="emp_name"/>
<result property="billingType" column="billing_type"/>
<result property="rateId" column="rate_id"/>
<result property="workTypeName" column="work_type_name"/>
<result property="itemName" column="item_name"/>
<result property="processName" column="process_name"/>
<result property="orderNo" column="order_no"/>
<result property="workload" column="workload"/>
<result property="unitPrice" column="unit_price"/>
<result property="baseAmount" column="base_amount"/>
<result property="extraAmount" column="extra_amount"/>
<result property="extraReason" column="extra_reason"/>
<result property="totalAmount" column="total_amount"/>
<result property="isMakeup" column="is_makeup"/>
<result property="sourceDetailId" column="source_detail_id"/>
<result property="makeupResponsibleId" column="makeup_responsible_id"/>
<result property="makeupResponsible" column="makeup_responsible"/>
<result property="makeupReason" column="makeup_reason"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>

View File

@@ -0,0 +1,25 @@
<?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.gear.oa.mapper.GearWageMakeupLogMapper">
<resultMap type="com.gear.oa.domain.GearWageMakeupLog" id="GearWageMakeupLogResult">
<result property="logId" column="log_id"/>
<result property="detailId" column="detail_id"/>
<result property="sourceDetailId" column="source_detail_id"/>
<result property="operationType" column="operation_type"/>
<result property="operationDate" column="operation_date"/>
<result property="empId" column="emp_id"/>
<result property="makeupResponsibleId" column="makeup_responsible_id"/>
<result property="makeupResponsible" column="makeup_responsible"/>
<result property="makeupReason" column="makeup_reason"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>

View File

@@ -0,0 +1,26 @@
<?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.gear.oa.mapper.GearWageRateConfigMapper">
<resultMap type="com.gear.oa.domain.GearWageRateConfig" id="GearWageRateConfigResult">
<result property="rateId" column="rate_id"/>
<result property="rateCode" column="rate_code"/>
<result property="rateName" column="rate_name"/>
<result property="billingType" column="billing_type"/>
<result property="workTypeName" column="work_type_name"/>
<result property="itemName" column="item_name"/>
<result property="processName" column="process_name"/>
<result property="workdayHours" column="workday_hours"/>
<result property="unitPrice" column="unit_price"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>

View File

@@ -0,0 +1,23 @@
<?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.gear.oa.mapper.GearWorkerMapper">
<resultMap type="com.gear.oa.domain.GearWorker" id="GearWorkerResult">
<result property="workerId" column="worker_id"/>
<result property="workerNo" column="worker_no"/>
<result property="workerName" column="worker_name"/>
<result property="phone" column="phone"/>
<result property="defaultBillingType" column="default_billing_type"/>
<result property="defaultWorkTypeName" column="default_work_type_name"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询报销列表
export function listReimbursement(query) {
return request({
url: '/oa/reimbursement/list',
method: 'get',
params: query
})
}
// 查询报销详细
export function getReimbursement(reimbursementId) {
return request({
url: '/oa/reimbursement/' + reimbursementId,
method: 'get'
})
}
// 新增报销
export function addReimbursement(data) {
return request({
url: '/oa/reimbursement',
method: 'post',
data: data
})
}
// 修改报销
export function updateReimbursement(data) {
return request({
url: '/oa/reimbursement',
method: 'put',
data: data
})
}
// 删除报销
export function delReimbursement(reimbursementId) {
return request({
url: '/oa/reimbursement/' + reimbursementId,
method: 'delete'
})
}

View File

@@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询工资录入明细列表
export function listWageEntryDetail(query) {
return request({
url: '/oa/wageEntryDetail/list',
method: 'get',
params: query
})
}
// 查询工资录入明细详细
export function getWageEntryDetail(detailId) {
return request({
url: '/oa/wageEntryDetail/' + detailId,
method: 'get'
})
}
// 新增工资录入明细
export function addWageEntryDetail(data) {
return request({
url: '/oa/wageEntryDetail',
method: 'post',
data: data
})
}
// 修改工资录入明细
export function updateWageEntryDetail(data) {
return request({
url: '/oa/wageEntryDetail',
method: 'put',
data: data
})
}
// 删除工资录入明细
export function delWageEntryDetail(detailId) {
return request({
url: '/oa/wageEntryDetail/' + detailId,
method: 'delete'
})
}
// 一键初始化当日工人名单
export function initDailyWorkers(data) {
return request({
url: '/oa/wageEntryDetail/initDailyWorkers',
method: 'post',
data
})
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询工资补录日志列表
export function listWageMakeupLog(query) {
return request({
url: '/oa/wageMakeupLog/list',
method: 'get',
params: query
})
}
// 查询工资补录日志详细
export function getWageMakeupLog(logId) {
return request({
url: '/oa/wageMakeupLog/' + logId,
method: 'get'
})
}
// 新增工资补录日志
export function addWageMakeupLog(data) {
return request({
url: '/oa/wageMakeupLog',
method: 'post',
data
})
}
// 修改工资补录日志
export function updateWageMakeupLog(data) {
return request({
url: '/oa/wageMakeupLog',
method: 'put',
data
})
}
// 删除工资补录日志
export function delWageMakeupLog(logId) {
return request({
url: '/oa/wageMakeupLog/' + logId,
method: 'delete'
})
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询工资费率配置列表
export function listWageRateConfig(query) {
return request({
url: '/oa/wageRateConfig/list',
method: 'get',
params: query
})
}
// 查询工资费率配置详细
export function getWageRateConfig(rateId) {
return request({
url: '/oa/wageRateConfig/' + rateId,
method: 'get'
})
}
// 新增工资费率配置
export function addWageRateConfig(data) {
return request({
url: '/oa/wageRateConfig',
method: 'post',
data: data
})
}
// 修改工资费率配置
export function updateWageRateConfig(data) {
return request({
url: '/oa/wageRateConfig',
method: 'put',
data: data
})
}
// 删除工资费率配置
export function delWageRateConfig(rateId) {
return request({
url: '/oa/wageRateConfig/' + rateId,
method: 'delete'
})
}

View File

@@ -0,0 +1,65 @@
import request from '@/utils/request'
// 查询工人列表
export function listWorker(query) {
return request({
url: '/oa/worker/list',
method: 'get',
params: query
})
}
// 查询工人详细
export function getWorker(workerId) {
return request({
url: '/oa/worker/' + workerId,
method: 'get'
})
}
// 新增工人
export function addWorker(data) {
return request({
url: '/oa/worker',
method: 'post',
data
})
}
// 修改工人
export function updateWorker(data) {
return request({
url: '/oa/worker',
method: 'put',
data
})
}
// 删除工人
export function delWorker(workerId) {
return request({
url: '/oa/worker/' + workerId,
method: 'delete'
})
}
// 下载导入模板
export function importTemplateWorker() {
return request({
url: '/oa/worker/importTemplate',
method: 'get',
responseType: 'blob'
})
}
// 导入工人
export function importWorkerData(data) {
return request({
url: '/oa/worker/importData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

View File

@@ -17,14 +17,14 @@
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
</el-upload>
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
的文件
</div>
</el-upload>
<!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">

View File

@@ -1,289 +1,11 @@
<template>
<div class="dashboard-root">
<!-- 第一行头像+欢迎语 -->
<UserGreeting />
<Statistic />
<!-- 全部应用 -->
<AllApplications @addFavorites="handleAddFavorites" />
</div>
<div class="home-full-bg"></div>
</template>
<script setup>
import AllApplications from '@/components/AllApplications.vue';
import UserGreeting from '@/views/components/Hello.vue';
import Statistic from '@/views/components/Statistic.vue';
</script>
<style scoped>
.dashboard-root {
min-height: 100vh;
/* background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%); */
padding: 32px;
.home-full-bg {
width: 100%;
height: 90vh;
background: url('@/assets/images/index.jpg') center center / 100% 100% no-repeat;
}
/* 业务功能区标题栏 */
.business-area-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.business-area-title {
font-size: 18px;
font-weight: 600;
color: #333;
margin: 0;
}
.edit-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background: #f3f4f6;
border: none;
border-radius: 6px;
color: #6b7280;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.edit-btn:hover {
background: #e5e7eb;
color: #374151;
}
/* 业务功能区样式 */
.business-modules {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 24px;
margin-bottom: 32px;
}
.business-module {
display: flex;
align-items: center;
padding: 16px;
border-radius: 12px;
background: #fff;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
transition: all 0.2s;
cursor: pointer;
}
.business-module:hover {
box-shadow: 0 4px 16px 0 rgba(0,0,0,0.1);
transform: translateY(-2px);
}
.business-module-icon {
width: 40px;
height: 40px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 12px;
background: #3b82f6; /* 默认图标背景色 */
}
.business-module-icon i {
font-size: 20px;
color: #fff;
}
.business-module-title {
font-size: 16px;
font-weight: 500;
color: #303133;
margin: 0;
}
/* 弹窗样式 */
.dialog-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.setting-dialog {
width: 500px;
background: #fff;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.dialog-header {
padding: 16px 24px;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
}
.dialog-header h3 {
margin: 0;
font-size: 18px;
color: #333;
}
.close-btn {
background: none;
border: none;
cursor: pointer;
color: #999;
font-size: 18px;
}
.close-btn:hover {
color: #333;
}
.dialog-content {
padding: 24px;
max-height: 400px;
overflow-y: auto;
}
.module-list {
list-style: none;
padding: 0;
margin: 0;
}
.module-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #f5f5f5;
}
.module-item:last-child {
border-bottom: none;
}
.module-info {
display: flex;
align-items: center;
gap: 12px;
}
.module-index {
width: 24px;
height: 24px;
border-radius: 50%;
background: #f3f4f6;
color: #6b7280;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.module-name {
font-size: 16px;
color: #333;
}
.module-actions {
display: flex;
gap: 8px;
}
.action-btn {
background: none;
border: none;
width: 32px;
height: 32px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s;
}
.move-btn {
color: #9ca3af;
background: #f9fafb;
}
.move-btn:hover {
background: #f3f4f6;
color: #6b7280;
}
.move-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.delete-btn {
color: #ef4444;
background: #fee2e2;
}
.delete-btn:hover {
background: #fecaca;
}
.empty-tip {
text-align: center;
padding: 40px 0;
color: #9ca3af;
font-size: 14px;
background: #f9fafb;
border-radius: 8px;
}
.dialog-footer {
padding: 16px 24px;
border-top: 1px solid #f0f0f0;
display: flex;
justify-content: flex-end;
gap: 12px;
}
.cancel-btn, .confirm-btn {
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
}
.cancel-btn {
background: #f3f4f6;
border: none;
color: #6b7280;
}
.cancel-btn:hover {
background: #e5e7eb;
color: #374151;
}
.confirm-btn {
background: #3b82f6;
border: none;
color: #fff;
}
.confirm-btn:hover {
background: #2563eb;
}
</style>
</style>

View File

@@ -0,0 +1,322 @@
<template>
<div class="app-container">
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="申请人" prop="applicantName">
<el-input v-model="queryParams.applicantName" placeholder="请输入申请人" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="报销状态" prop="reimburseStatus">
<el-select v-model="queryParams.reimburseStatus" placeholder="请选择状态" clearable style="width: 180px">
<el-option label="未报销" value="0" />
<el-option label="已报销" value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="reimbursementList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="申请人" align="center" prop="applicantName" width="120" />
<el-table-column label="附件" align="left" min-width="260">
<template #default="scope">
<div v-if="scope.row._attachmentFiles?.length" class="attachment-list">
<el-link
v-for="file in scope.row._attachmentFiles"
:key="file.ossId"
:href="file.url"
target="_blank"
type="primary"
:underline="false"
class="attachment-link"
>
{{ file.originalName || file.fileName || `附件-${file.ossId}` }}
</el-link>
</div>
<span v-else class="text-muted">无附件</span>
</template>
</el-table-column>
<el-table-column label="上传时间" align="center" prop="uploadTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.uploadTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="amount" width="120" />
<el-table-column label="状态" align="center" width="180">
<template #default="scope">
<el-switch
:model-value="scope.row.reimburseStatus === '1'"
active-text="已报销"
inactive-text="未报销"
inline-prompt
@change="(val) => handleQuickStatusChange(scope.row, val)"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="reimbursementRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="附件" prop="attachmentUrl">
<div class="upload-wrap">
<file-upload v-model="form.attachmentUrl" :limit="3" />
</div>
</el-form-item>
<el-form-item label="上传时间" prop="uploadTime">
<el-date-picker
clearable
v-model="form.uploadTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择上传时间"
/>
</el-form-item>
<el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Reimbursement">
import { listReimbursement, getReimbursement, delReimbursement, addReimbursement, updateReimbursement } from '@/api/oa/reimbursement'
import { listByIds } from '@/api/system/oss'
const { proxy } = getCurrentInstance()
const reimbursementList = ref([])
const open = ref(false)
const buttonLoading = ref(false)
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref('')
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
applicantName: undefined,
reimburseStatus: undefined
},
rules: {
uploadTime: [{ required: true, message: '上传时间不能为空', trigger: 'change' }],
amount: [{ required: true, message: '金额不能为空', trigger: 'blur' }]
}
})
const { queryParams, form, rules } = toRefs(data)
async function hydrateAttachmentFiles(list) {
const idSet = new Set()
list.forEach(row => {
const ids = (row.attachmentUrl || '').split(',').map(i => i.trim()).filter(Boolean)
ids.forEach(id => idSet.add(id))
})
if (!idSet.size) {
reimbursementList.value = list.map(row => ({ ...row, _attachmentFiles: [] }))
return
}
const idStr = Array.from(idSet).join(',')
const res = await listByIds(idStr)
const files = res?.data || []
const fileMap = new Map(files.map(f => [String(f.ossId), f]))
reimbursementList.value = list.map(row => {
const ids = (row.attachmentUrl || '').split(',').map(i => i.trim()).filter(Boolean)
const attachmentFiles = ids.map(id => fileMap.get(id)).filter(Boolean)
return { ...row, _attachmentFiles: attachmentFiles }
})
}
function getList() {
loading.value = true
listReimbursement(queryParams.value).then(async response => {
total.value = response.total
await hydrateAttachmentFiles(response.rows || [])
}).finally(() => {
loading.value = false
})
}
function cancel() {
open.value = false
reset()
}
function reset() {
form.value = {
reimbursementId: null,
attachmentUrl: null,
uploadTime: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
amount: null,
remark: null
}
proxy.resetForm('reimbursementRef')
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
handleQuery()
}
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.reimbursementId)
single.value = selection.length !== 1
multiple.value = !selection.length
}
function handleAdd() {
reset()
open.value = true
title.value = '添加报销'
}
function handleUpdate(row) {
loading.value = true
reset()
const _reimbursementId = row.reimbursementId || ids.value
getReimbursement(_reimbursementId).then(response => {
form.value = response.data
open.value = true
title.value = '修改报销'
}).finally(() => {
loading.value = false
})
}
function submitForm() {
proxy.$refs.reimbursementRef.validate(valid => {
if (!valid) {
return
}
buttonLoading.value = true
const req = form.value.reimbursementId != null ? updateReimbursement(form.value) : addReimbursement(form.value)
req.then(() => {
proxy.$modal.msgSuccess(form.value.reimbursementId != null ? '修改成功' : '新增成功')
open.value = false
getList()
}).finally(() => {
buttonLoading.value = false
})
})
}
function handleQuickStatusChange(row, val) {
const oldStatus = row.reimburseStatus
const targetStatus = val ? '1' : '0'
const statusText = targetStatus === '1' ? '已报销' : '未报销'
proxy.$modal.confirm(`确认将状态改为${statusText}吗?`).then(() => {
const payload = {
...row,
reimburseStatus: targetStatus
}
return updateReimbursement(payload)
}).then(() => {
row.reimburseStatus = targetStatus
proxy.$modal.msgSuccess('状态更新成功')
}).catch(() => {
row.reimburseStatus = oldStatus
})
}
function handleDelete(row) {
const _reimbursementIds = row.reimbursementId || ids.value
proxy.$modal.confirm('是否确认删除报销编号为"' + _reimbursementIds + '"的数据项?').then(function () {
loading.value = true
return delReimbursement(_reimbursementIds)
}).then(() => {
getList()
proxy.$modal.msgSuccess('删除成功')
}).finally(() => {
loading.value = false
})
}
function handleExport() {
proxy.download('oa/reimbursement/export', {
...queryParams.value
}, `reimbursement_${new Date().getTime()}.xlsx`)
}
getList()
</script>
<style scoped>
.upload-wrap {
width: 100%;
display: flex;
flex-direction: column;
gap: 10px;
}
.upload-tip {
margin-top: 2px;
}
.attachment-list {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 4px;
}
.attachment-link {
max-width: 240px;
}
.text-muted {
color: #909399;
}
</style>

View File

@@ -0,0 +1,275 @@
<template>
<div class="app-container">
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="员工姓名" prop="empName">
<el-input v-model="queryParams.empName" placeholder="请输入员工姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-select v-model="queryParams.billingType" placeholder="请选择计费类型" clearable style="width: 180px">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-alert type="info" :closable="false" show-icon style="margin-bottom: 10px">
小时工/天工工作量表示工作时间计件工工作量表示加工数量仅计件工可录入单价
</el-alert>
<el-row :gutter="10" class="mb8">
<el-col :span="2.5">
<el-button size="small" type="info" plain icon="RefreshRight" @click="handleInitDaily(true)">重置当日名单</el-button>
</el-col>
<el-col :span="1.8">
<el-button size="small" type="primary" plain icon="Check" @click="saveAllRows">全部保存</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="wageEntryDetailList">
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
</el-table-column>
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
<el-table-column label="工作时间/加工数量" align="center" min-width="170">
<template #default="scope">
<el-input
v-model="scope.row.workload"
:placeholder="workloadPlaceholder(scope.row.billingType)"
@input="recalcRowAmount(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="150">
<template #default="scope">
<el-input v-if="scope.row.billingType === '2'" v-model="scope.row.unitPrice" placeholder="多少钱/件" @input="recalcRowAmount(scope.row)" />
<span v-else>{{ formatUnitPrice(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="奖惩金额" align="center" min-width="130">
<template #default="scope">
<el-input v-model="scope.row.extraAmount" placeholder="奖惩金额(负数为惩罚)" @input="recalcRowAmount(scope.row)" />
</template>
</el-table-column>
<el-table-column label="奖惩原因" align="center" min-width="180">
<template #default="scope">
<el-input v-model="scope.row.extraReason" placeholder="奖惩原因" />
</template>
</el-table-column>
<el-table-column label="总金额" align="center" prop="totalAmount" width="110" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="170">
<template #default="scope">
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</div>
</template>
<script setup name="WageEntryDetail">
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail, initDailyWorkers } from '@/api/oa/wageEntryDetail'
import { ElMessage } from 'element-plus'
const { proxy } = getCurrentInstance()
const wageEntryDetailList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const total = ref(0)
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 100,
entryDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
empName: undefined,
billingType: undefined,
isMakeup: '0'
}
})
const { queryParams } = toRefs(data)
function formatBillingType(type) {
if (type === '1') return '小时工'
if (type === '2') return '计件工'
if (type === '3') return '天工'
return '-'
}
function workloadPlaceholder(type) {
return type === '2' ? '加工数量' : '工作时间'
}
function formatUnitPrice(row) {
const price = row?.unitPrice ?? ''
if (row?.billingType === '1') return `${price || 0}元/小时`
if (row?.billingType === '2') return `${price || 0}元/件`
if (row?.billingType === '3') return `${price || 0}元/天`
return '-'
}
function normalizeEditableValue(v) {
if (v === null || v === undefined) return ''
if (String(v) === '0' || String(v) === '0.00') return ''
return v
}
function toNumber(v) {
const n = Number(v)
return Number.isFinite(n) ? n : 0
}
function round2(v) {
return Math.round(v * 100) / 100
}
function recalcRowAmount(row) {
const workload = toNumber(row.workload)
const unitPrice = row.billingType === '2' ? toNumber(row.unitPrice) : toNumber(row.unitPrice)
const extraAmount = toNumber(row.extraAmount)
const baseAmount = round2(workload * unitPrice)
row.baseAmount = baseAmount
row.totalAmount = round2(baseAmount + extraAmount)
}
function getList() {
loading.value = true
listWageEntryDetail(queryParams.value).then(response => {
const rows = response.rows || []
wageEntryDetailList.value = rows.map(row => {
const r = {
...row,
workload: normalizeEditableValue(row.workload),
unitPrice: normalizeEditableValue(row.unitPrice),
extraAmount: normalizeEditableValue(row.extraAmount)
}
recalcRowAmount(r)
return r
})
total.value = response.total || 0
}).finally(() => {
loading.value = false
})
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
queryParams.value.entryDate = proxy.parseTime(new Date(), '{y}-{m}-{d}')
queryParams.value.isMakeup = '0'
handleQuery()
}
function buildRowPayload(row) {
const payload = { ...row }
if (payload.workload === '' || payload.workload === null || payload.workload === undefined) {
payload.workload = 0
}
if (payload.extraAmount === '' || payload.extraAmount === null || payload.extraAmount === undefined) {
payload.extraAmount = 0
}
if (payload.billingType !== '2') {
payload.unitPrice = null
} else if (payload.unitPrice === '' || payload.unitPrice === null || payload.unitPrice === undefined) {
payload.unitPrice = 0
}
return payload
}
function saveRow(row) {
const payload = buildRowPayload(row)
updateWageEntryDetail(payload).then(() => {
proxy.$modal.msgSuccess('保存成功')
getList()
})
}
async function saveAllRows() {
if (!wageEntryDetailList.value.length) {
proxy.$modal.msgInfo('暂无可保存的数据')
return
}
loading.value = true
let successCount = 0
let failCount = 0
for (const row of wageEntryDetailList.value) {
const payload = buildRowPayload(row)
try {
await updateWageEntryDetail(payload)
successCount++
} catch (e) {
failCount++
}
}
loading.value = false
if (failCount === 0) {
proxy.$modal.msgSuccess(`全部保存完成,共 ${successCount}`)
} else {
ElMessage.warning(`保存完成:成功 ${successCount} 条,失败 ${failCount}`)
}
getList()
}
function handleDelete(row) {
const detailId = row?.detailId
if (!detailId) return
proxy.$modal.confirm('是否确认删除该工资录入记录?').then(() => delWageEntryDetail(detailId)).then(() => {
proxy.$modal.msgSuccess('删除成功')
getList()
})
}
function handleExport() {
proxy.download('oa/wageEntryDetail/export', {
...queryParams.value
}, `wage_entry_detail_${new Date().getTime()}.xlsx`)
}
function handleInitDaily(forceReset = false) {
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
const text = forceReset ? `确认重置 ${entryDate} 的当日名单吗?将先删除后重建。` : `确认初始化 ${entryDate} 的工人名单吗?`
proxy.$modal.confirm(text).then(() => {
return initDailyWorkers({ entryDate, forceReset })
}).then(res => {
if (!forceReset && Number(res.data || 0) === 0) {
proxy.$modal.msgInfo('当日名单已存在,未重复初始化')
} else {
proxy.$modal.msgSuccess(`操作成功,共写入 ${res.data || 0}`)
}
getList()
})
}
async function autoInitFirstEnter() {
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
await initDailyWorkers({ entryDate, forceReset: false })
}
onMounted(async () => {
await autoInitFirstEnter()
getList()
})
</script>

View File

@@ -0,0 +1,233 @@
<template>
<div class="app-container">
<el-alert type="warning" :closable="false" show-icon style="margin-bottom: 10px">
本页面可查看所有工资录入数据点击补录后将该记录标记为已补录isMakeup=1
</el-alert>
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="业务日期" prop="entryDate">
<el-date-picker clearable v-model="queryParams.entryDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择业务日期" />
</el-form-item>
<el-form-item label="员工姓名" prop="empName">
<el-input v-model="queryParams.empName" placeholder="请输入员工姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="查看范围" prop="makeupView">
<el-select v-model="queryParams.makeupView" placeholder="请选择查看范围" style="width: 150px" @change="handleQuery">
<el-option label="全部查看" value="all" />
<el-option label="仅看补录" value="onlyMakeup" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="list">
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
</el-table-column>
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
<el-table-column label="工作时间/加工数量" align="center" prop="workload" width="140" />
<el-table-column label="单价" align="center" prop="unitPrice" width="110" />
<el-table-column label="奖惩金额" align="center" prop="extraAmount" width="130" />
<el-table-column label="奖惩原因" align="center" prop="extraReason" min-width="160" :show-overflow-tooltip="true" />
<el-table-column label="补录状态" align="center" prop="isMakeup" width="100">
<template #default="scope">
<el-tag :type="scope.row.isMakeup === '1' ? 'warning' : 'info'">{{ scope.row.isMakeup === '1' ? '已补录' : '未补录' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="补录责任人" align="center" prop="makeupResponsible" width="120" />
<el-table-column label="补录原因" align="center" prop="makeupReason" min-width="180" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="220">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleMakeup(scope.row)">补录</el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<el-dialog :title="title" v-model="open" width="640px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-form-item label="业务日期" prop="entryDate">
<el-date-picker clearable v-model="form.entryDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
</el-form-item>
<el-form-item label="员工姓名" prop="empName"><el-input v-model="form.empName" /></el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-select v-model="form.billingType" style="width: 100%">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item label="工种" prop="workTypeName"><el-input v-model="form.workTypeName" /></el-form-item>
<el-form-item :label="form.billingType === '2' ? '加工数量' : '工作时间'" prop="workload"><el-input v-model="form.workload" /></el-form-item>
<el-form-item label="单价" prop="unitPrice" v-if="form.billingType === '2'"><el-input v-model="form.unitPrice" placeholder="元/件" /></el-form-item>
<el-form-item label="奖惩金额" prop="extraAmount"><el-input v-model="form.extraAmount" placeholder="负数为惩罚金额" /></el-form-item>
<el-form-item label="奖惩原因" prop="extraReason"><el-input v-model="form.extraReason" placeholder="请输入奖惩原因" /></el-form-item>
<el-form-item label="补录原因" prop="makeupReason"><el-input type="textarea" v-model="form.makeupReason" /></el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="WageMakeup">
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const list = ref([])
const loading = ref(true)
const total = ref(0)
const showSearch = ref(true)
const open = ref(false)
const title = ref('')
const buttonLoading = ref(false)
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 50,
entryDate: undefined,
empName: undefined,
makeupView: 'all'
},
rules: {
entryDate: [{ required: true, message: '业务日期不能为空', trigger: 'change' }],
empId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
billingType: [{ required: true, message: '计费类型不能为空', trigger: 'change' }],
rateId: [{ required: true, message: '费率ID不能为空', trigger: 'blur' }],
workload: [{ required: true, message: '工作量不能为空', trigger: 'blur' }],
makeupReason: [{ required: true, message: '补录原因不能为空', trigger: 'blur' }]
}
})
const { queryParams, form, rules } = toRefs(data)
function formatBillingType(type) {
if (type === '1') return '小时工'
if (type === '2') return '计件工'
if (type === '3') return '天工'
return '-'
}
function buildQuery() {
const q = {
pageNum: queryParams.value.pageNum,
pageSize: queryParams.value.pageSize,
entryDate: queryParams.value.entryDate,
empName: queryParams.value.empName
}
if (queryParams.value.makeupView === 'onlyMakeup') {
q.isMakeup = '1'
}
return q
}
function getList() {
loading.value = true
listWageEntryDetail(buildQuery()).then(res => {
list.value = res.rows || []
total.value = res.total || 0
}).finally(() => {
loading.value = false
})
}
function resetForm() {
form.value = {
detailId: null,
sourceDetailId: null,
entryDate: null,
empId: null,
empName: null,
billingType: '1',
rateId: null,
workTypeName: null,
workload: null,
unitPrice: null,
extraAmount: 0,
extraReason: null,
isMakeup: '1',
makeupResponsibleId: userStore.id || null,
makeupResponsible: userStore.nickName || null,
makeupReason: null
}
}
function handleMakeup(row) {
form.value = {
...row,
sourceDetailId: row.detailId,
isMakeup: '1',
makeupResponsibleId: userStore.id || row.makeupResponsibleId || null,
makeupResponsible: userStore.nickName || row.makeupResponsible || null,
makeupReason: row.makeupReason || null
}
title.value = '补录 补录负责人:'+form.value.makeupResponsible
open.value = true
}
function submitForm() {
proxy.$refs.formRef.validate(valid => {
if (!valid) return
buttonLoading.value = true
const payload = {
...form.value,
isMakeup: '1'
}
// 本页面补录语义:更新当前记录并标记为已补录
updateWageEntryDetail(payload).then(() => {
proxy.$modal.msgSuccess('补录成功')
open.value = false
getList()
}).finally(() => {
buttonLoading.value = false
})
})
}
function handleDelete(row) {
proxy.$modal.confirm('确认删除该记录吗?').then(() => delWageEntryDetail(row.detailId)).then(() => {
proxy.$modal.msgSuccess('删除成功')
getList()
})
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
queryParams.value.entryDate = undefined
queryParams.value.makeupView = 'all'
handleQuery()
}
function handleExport() {
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
}
getList()
</script>

View File

@@ -0,0 +1,268 @@
<template>
<div class="app-container">
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="目标日期" prop="operationDate">
<el-date-picker
clearable
v-model="queryParams.operationDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择目标日期"
/>
</el-form-item>
<el-form-item label="操作类型" prop="operationType">
<el-select v-model="queryParams.operationType" placeholder="请选择操作类型" clearable style="width: 180px">
<el-option label="新增补录" value="1" />
<el-option label="修改补录" value="2" />
<el-option label="撤销补录" value="3" />
</el-select>
</el-form-item>
<el-form-item label="责任人" prop="makeupResponsible">
<el-input v-model="queryParams.makeupResponsible" placeholder="请输入责任人" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="wageMakeupLogList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="日志ID" align="center" prop="logId" width="90" />
<el-table-column label="目标日期" align="center" prop="operationDate" width="120" />
<el-table-column label="员工ID" align="center" prop="empId" width="100" />
<el-table-column label="操作类型" align="center" prop="operationType" width="110">
<template #default="scope">{{ formatOperationType(scope.row.operationType) }}</template>
</el-table-column>
<el-table-column label="明细ID" align="center" prop="detailId" width="100" />
<el-table-column label="原始明细ID" align="center" prop="sourceDetailId" width="110" />
<el-table-column label="责任人" align="center" prop="makeupResponsible" width="120" />
<el-table-column label="补录原因" align="center" prop="makeupReason" min-width="220" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" min-width="160">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="目标日期" prop="operationDate">
<el-date-picker
clearable
v-model="form.operationDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择目标日期"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="操作类型" prop="operationType">
<el-select v-model="form.operationType" placeholder="请选择操作类型" style="width: 100%">
<el-option label="新增补录" value="1" />
<el-option label="修改补录" value="2" />
<el-option label="撤销补录" value="3" />
</el-select>
</el-form-item>
<el-form-item label="员工ID" prop="empId">
<el-input v-model="form.empId" placeholder="请输入员工ID" />
</el-form-item>
<el-form-item label="明细ID" prop="detailId">
<el-input v-model="form.detailId" placeholder="请输入明细ID" />
</el-form-item>
<el-form-item label="原始明细ID" prop="sourceDetailId">
<el-input v-model="form.sourceDetailId" placeholder="请输入原始明细ID" />
</el-form-item>
<el-form-item label="责任人ID" prop="makeupResponsibleId">
<el-input v-model="form.makeupResponsibleId" placeholder="请输入责任人ID" />
</el-form-item>
<el-form-item label="责任人" prop="makeupResponsible">
<el-input v-model="form.makeupResponsible" placeholder="请输入责任人姓名" />
</el-form-item>
<el-form-item label="补录原因" prop="makeupReason">
<el-input v-model="form.makeupReason" type="textarea" placeholder="请输入补录原因" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="WageMakeupLog">
import { listWageMakeupLog, getWageMakeupLog, addWageMakeupLog, updateWageMakeupLog, delWageMakeupLog } from '@/api/oa/wageMakeupLog'
const { proxy } = getCurrentInstance()
const wageMakeupLogList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const total = ref(0)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const open = ref(false)
const title = ref('')
const buttonLoading = ref(false)
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
operationDate: undefined,
operationType: undefined,
makeupResponsible: undefined
},
rules: {
operationDate: [{ required: true, message: '目标日期不能为空', trigger: 'change' }],
operationType: [{ required: true, message: '操作类型不能为空', trigger: 'change' }],
empId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
detailId: [{ required: true, message: '明细ID不能为空', trigger: 'blur' }]
}
})
const { queryParams, form, rules } = toRefs(data)
function formatOperationType(type) {
if (type === '1') return '新增补录'
if (type === '2') return '修改补录'
if (type === '3') return '撤销补录'
return '-'
}
function getList() {
loading.value = true
listWageMakeupLog(queryParams.value).then(response => {
wageMakeupLogList.value = response.rows || []
total.value = response.total || 0
}).finally(() => {
loading.value = false
})
}
function reset() {
form.value = {
logId: null,
operationDate: null,
operationType: '1',
empId: null,
detailId: null,
sourceDetailId: null,
makeupResponsibleId: null,
makeupResponsible: null,
makeupReason: null,
remark: null
}
proxy.resetForm('formRef')
}
function cancel() {
open.value = false
reset()
}
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.logId)
single.value = selection.length !== 1
multiple.value = !selection.length
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
handleQuery()
}
function handleAdd() {
reset()
open.value = true
title.value = '新增工资补录日志'
}
function handleUpdate(row) {
const logId = row?.logId || ids.value[0]
if (!logId) return
reset()
getWageMakeupLog(logId).then(response => {
form.value = response.data
open.value = true
title.value = '修改工资补录日志'
})
}
function submitForm() {
proxy.$refs.formRef.validate(valid => {
if (!valid) return
buttonLoading.value = true
const req = form.value.logId ? updateWageMakeupLog(form.value) : addWageMakeupLog(form.value)
req.then(() => {
proxy.$modal.msgSuccess(form.value.logId ? '修改成功' : '新增成功')
open.value = false
getList()
}).finally(() => {
buttonLoading.value = false
})
})
}
function handleDelete(row) {
const logIds = row?.logId || ids.value
if (!logIds || (Array.isArray(logIds) && !logIds.length)) return
proxy.$modal.confirm('是否确认删除工资补录日志数据项?').then(() => {
return delWageMakeupLog(logIds)
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
getList()
})
}
function handleExport() {
proxy.download('oa/wageMakeupLog/export', {
...queryParams.value
}, `wage_makeup_log_${new Date().getTime()}.xlsx`)
}
getList()
</script>

View File

@@ -0,0 +1,268 @@
<template>
<div class="app-container">
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="工名" prop="rateName">
<el-input v-model="queryParams.rateName" placeholder="请输入工名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-select v-model="queryParams.billingType" placeholder="请选择计费类型" clearable style="width: 180px">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="wageRateConfigList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工名" align="center" prop="rateName" />
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="unitPrice" width="120">
<template #default="scope">
<span>{{ scope.row.unitPrice }} {{ unitText(scope.row.billingType) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope">
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'">{{ scope.row.status === '0' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="工名" prop="rateName">
<el-input v-model="form.rateName" placeholder="例如:打包工/木工" />
</el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-select v-model="form.billingType" placeholder="请选择计费类型" style="width: 100%">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item :label="unitPriceLabel" prop="unitPrice">
<el-input v-model="form.unitPrice" :placeholder="unitPricePlaceholder" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">停用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="WageRateConfig">
import { computed } from 'vue'
import { listWageRateConfig, getWageRateConfig, addWageRateConfig, updateWageRateConfig, delWageRateConfig } from '@/api/oa/wageRateConfig'
const { proxy } = getCurrentInstance()
const wageRateConfigList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref('')
const open = ref(false)
const buttonLoading = ref(false)
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
rateName: undefined,
billingType: undefined
},
rules: {
rateName: [{ required: true, message: '工名不能为空', trigger: 'blur' }],
billingType: [{ required: true, message: '计费类型不能为空', trigger: 'change' }],
unitPrice: [{ required: true, message: '单价不能为空', trigger: 'blur' }]
}
})
const { queryParams, form, rules } = toRefs(data)
const unitPriceLabel = computed(() => {
if (form.value.billingType === '1') return '小时单价(元/小时)'
if (form.value.billingType === '2') return '件单价(元/件)'
if (form.value.billingType === '3') return '日薪(元/天)'
return '单价'
})
const unitPricePlaceholder = computed(() => {
if (form.value.billingType === '1') return '请输入每小时多少钱'
if (form.value.billingType === '2') return '请输入每件多少钱'
if (form.value.billingType === '3') return '请输入每天多少钱'
return '请输入单价'
})
function formatBillingType(type) {
if (type === '1') return '小时工'
if (type === '2') return '计件工'
if (type === '3') return '天工'
return '-'
}
function unitText(type) {
if (type === '1') return '元/小时'
if (type === '2') return '元/件'
if (type === '3') return '元/天'
return ''
}
function getList() {
loading.value = true
listWageRateConfig(queryParams.value).then(response => {
wageRateConfigList.value = response.rows || []
total.value = response.total || 0
}).finally(() => {
loading.value = false
})
}
function reset() {
form.value = {
rateId: null,
rateCode: 'AUTO',
rateName: null,
billingType: '1',
workTypeName: null,
itemName: null,
processName: null,
workdayHours: null,
unitPrice: null,
status: '0',
remark: null
}
proxy.resetForm('formRef')
}
function cancel() {
open.value = false
reset()
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
handleQuery()
}
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.rateId)
single.value = selection.length !== 1
multiple.value = !selection.length
}
function handleAdd() {
reset()
open.value = true
title.value = '新增工资费率配置'
}
function handleUpdate(row) {
const rateId = row?.rateId || ids.value[0]
if (!rateId) return
reset()
getWageRateConfig(rateId).then(response => {
form.value = { ...response.data, rateCode: response.data.rateCode || 'AUTO' }
open.value = true
title.value = '修改工资费率配置'
})
}
function submitForm() {
proxy.$refs.formRef.validate(valid => {
if (!valid) return
buttonLoading.value = true
form.value.workTypeName = ''
form.value.itemName = ''
form.value.processName = ''
form.value.workdayHours = null
const req = form.value.rateId ? updateWageRateConfig(form.value) : addWageRateConfig(form.value)
req.then(() => {
proxy.$modal.msgSuccess(form.value.rateId ? '修改成功' : '新增成功')
open.value = false
getList()
}).finally(() => {
buttonLoading.value = false
})
})
}
function handleDelete(row) {
const rateIds = row?.rateId || ids.value
if (!rateIds || (Array.isArray(rateIds) && !rateIds.length)) return
proxy.$modal.confirm('是否确认删除工资费率配置数据项?').then(() => {
return delWageRateConfig(rateIds)
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
getList()
})
}
function handleExport() {
proxy.download('oa/wageRateConfig/export', {
...queryParams.value
}, `wage_rate_config_${new Date().getTime()}.xlsx`)
}
getList()
</script>

View File

@@ -0,0 +1,362 @@
<template>
<div class="app-container">
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="80px">
<el-form-item label="工号" prop="workerNo">
<el-input v-model="queryParams.workerNo" placeholder="请输入工号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="姓名" prop="workerName">
<el-input v-model="queryParams.workerName" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 140px">
<el-option label="在职" value="0" />
<el-option label="离职" value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5"><el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="info" plain icon="Upload" @click="openImport">导入</el-button></el-col>
<el-col :span="1.8"><el-button size="small" plain icon="Download" @click="downloadTemplate">下载模板</el-button></el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="workerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工号" align="center" prop="workerNo" width="140" />
<el-table-column label="姓名" align="center" prop="workerName" width="120" />
<el-table-column label="手机号" align="center" prop="phone" width="140" />
<el-table-column label="默认计费类型" align="center" prop="defaultBillingType" width="120">
<template #default="scope">{{ formatBillingType(scope.row.defaultBillingType) }}</template>
</el-table-column>
<el-table-column label="默认工种" align="center" prop="defaultWorkTypeName" min-width="140" />
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope"><el-tag :type="scope.row.status === '0' ? 'success' : 'info'">{{ scope.row.status === '0' ? '在职' : '离职' }}</el-tag></template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="工号" prop="workerNo">
<el-input v-model="form.workerNo" placeholder="默认已生成,可手动修改" />
</el-form-item>
<el-form-item label="姓名" prop="workerName"><el-input v-model="form.workerName" placeholder="请输入姓名" /></el-form-item>
<el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" placeholder="请输入手机号" /></el-form-item>
<el-form-item label="默认工种" prop="selectedRateId">
<el-select v-model="form.selectedRateId" placeholder="请选择默认工种" style="width: 100%" clearable @change="handleRateChange">
<el-option
v-for="item in rateOptions"
:key="item.rateId"
:label="rateOptionLabel(item)"
:value="item.rateId"
/>
</el-select>
</el-form-item>
<el-form-item label="默认计费类型" prop="defaultBillingType">
<el-select v-model="form.defaultBillingType" placeholder="请选择" style="width: 100%" disabled>
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">在职</el-radio>
<el-radio label="1">离职</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark"><el-input v-model="form.remark" type="textarea" placeholder="请输入备注" /></el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<el-dialog title="导入工人" v-model="importOpen" width="520px" append-to-body>
<el-form label-width="140px">
<el-form-item label="更新已存在数据">
<el-switch v-model="updateSupport" />
</el-form-item>
<el-form-item label="选择Excel文件">
<el-upload
ref="uploadRef"
:auto-upload="false"
:limit="1"
accept=".xlsx,.xls"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
>
<el-button type="primary">选择文件</el-button>
<template #tip>
<div class="el-upload__tip">仅支持 .xls/.xlsx 文件</div>
</template>
</el-upload>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="importLoading" type="primary" @click="submitImport"> </el-button>
<el-button @click="importOpen = false"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Worker">
import { listWorker, getWorker, addWorker, updateWorker, delWorker, importWorkerData } from '@/api/oa/worker'
import { listWageRateConfig } from '@/api/oa/wageRateConfig'
const { proxy } = getCurrentInstance()
const workerList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref('')
const open = ref(false)
const buttonLoading = ref(false)
const importOpen = ref(false)
const importLoading = ref(false)
const updateSupport = ref(false)
const importFile = ref(null)
const rateOptions = ref([])
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
workerNo: undefined,
workerName: undefined,
status: undefined
},
rules: {
workerNo: [{ required: true, message: '工号不能为空', trigger: 'blur' }],
workerName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
selectedRateId: [{ required: true, message: '默认工种不能为空', trigger: 'change' }]
}
})
const { queryParams, form, rules } = toRefs(data)
function formatBillingType(type) {
if (type === '1') return '小时工'
if (type === '2') return '计件工'
if (type === '3') return '天工'
return '-'
}
function unitText(type) {
if (type === '1') return '元/小时'
if (type === '2') return '元/件'
if (type === '3') return '元/天'
return ''
}
function rateOptionLabel(item) {
return `${item.rateName || '-'}-${formatBillingType(item.billingType)}-${item.unitPrice || 0}${unitText(item.billingType)}`
}
function buildDefaultWorkerNo() {
const now = new Date()
const y = now.getFullYear()
const m = String(now.getMonth() + 1).padStart(2, '0')
const d = String(now.getDate()).padStart(2, '0')
const h = String(now.getHours()).padStart(2, '0')
const min = String(now.getMinutes()).padStart(2, '0')
const s = String(now.getSeconds()).padStart(2, '0')
const rand = Math.floor(Math.random() * 900 + 100)
return `WK${y}${m}${d}${h}${min}${s}${rand}`
}
function getList() {
loading.value = true
listWorker(queryParams.value).then(response => {
workerList.value = response.rows || []
total.value = response.total || 0
}).finally(() => {
loading.value = false
})
}
function loadRateOptions() {
return listWageRateConfig({ pageNum: 1, pageSize: 1000, status: '0' }).then(res => {
rateOptions.value = res.rows || []
})
}
function handleRateChange(rateId) {
const picked = rateOptions.value.find(i => i.rateId === rateId)
if (!picked) {
form.value.defaultBillingType = '1'
form.value.defaultWorkTypeName = null
return
}
form.value.defaultBillingType = picked.billingType
form.value.defaultWorkTypeName = picked.rateName
}
function reset() {
form.value = {
workerId: null,
workerNo: buildDefaultWorkerNo(),
workerName: null,
phone: null,
selectedRateId: null,
defaultBillingType: '1',
defaultWorkTypeName: null,
status: '0',
remark: null
}
proxy.resetForm('formRef')
}
function cancel() {
open.value = false
reset()
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('queryRef')
handleQuery()
}
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.workerId)
single.value = selection.length !== 1
multiple.value = !selection.length
}
function handleAdd() {
loadRateOptions().then(() => {
reset()
open.value = true
title.value = '新增工人'
})
}
function handleUpdate(row) {
const workerId = row?.workerId || ids.value[0]
if (!workerId) return
Promise.all([loadRateOptions(), getWorker(workerId)]).then(([, response]) => {
form.value = {
...response.data,
selectedRateId: null
}
const matched = rateOptions.value.find(i => i.rateName === form.value.defaultWorkTypeName && i.billingType === form.value.defaultBillingType)
if (matched) {
form.value.selectedRateId = matched.rateId
}
open.value = true
title.value = '修改工人'
})
}
function submitForm() {
proxy.$refs.formRef.validate(valid => {
if (!valid) return
buttonLoading.value = true
const payload = {
...form.value
}
delete payload.selectedRateId
const req = payload.workerId ? updateWorker(payload) : addWorker(payload)
req.then(() => {
proxy.$modal.msgSuccess(payload.workerId ? '修改成功' : '新增成功')
open.value = false
getList()
}).finally(() => {
buttonLoading.value = false
})
})
}
function handleDelete(row) {
const workerIds = row?.workerId || ids.value
if (!workerIds || (Array.isArray(workerIds) && !workerIds.length)) return
proxy.$modal.confirm('是否确认删除工人数据项?').then(() => {
return delWorker(workerIds)
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
getList()
})
}
function handleExport() {
proxy.download('oa/worker/export', {
...queryParams.value
}, `worker_${new Date().getTime()}.xlsx`)
}
function openImport() {
importOpen.value = true
}
function handleFileChange(file) {
importFile.value = file.raw
}
function handleFileRemove() {
importFile.value = null
}
function downloadTemplate() {
proxy.download('oa/worker/importTemplate', {}, `worker_template_${new Date().getTime()}.xlsx`)
}
function submitImport() {
if (!importFile.value) {
proxy.$modal.msgWarning('请先选择导入文件')
return
}
const formData = new FormData()
formData.append('file', importFile.value)
formData.append('updateSupport', updateSupport.value)
importLoading.value = true
importWorkerData(formData).then(res => {
proxy.$modal.msgSuccess(res.msg || '导入成功')
importOpen.value = false
importFile.value = null
getList()
}).finally(() => {
importLoading.value = false
})
}
getList()
</script>

View File

@@ -42,7 +42,7 @@ export default defineConfig(({ mode, command }) => {
},
// vite 相关配置
server: {
port: 81,
port: 1024,
host: true,
open: true,
// 如果端口占用自动切换端口

View File

@@ -0,0 +1,188 @@
-- 报销模块表结构仅CRUD无审批流
DROP TABLE IF EXISTS gear_reimbursement;
CREATE TABLE gear_reimbursement (
reimbursement_id bigint(20) NOT NULL COMMENT '报销ID',
applicant_id bigint(20) NOT NULL COMMENT '申请人用户ID',
applicant_name varchar(64) NOT NULL COMMENT '申请人名称',
attachment_url varchar(500) DEFAULT '' COMMENT '附件地址',
upload_time datetime COMMENT '上传时间',
amount decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '报销金额',
reimburse_status char(1) NOT NULL DEFAULT '0' COMMENT '报销状态0未报销 1已报销',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (reimbursement_id),
KEY idx_applicant_id (applicant_id),
KEY idx_reimburse_status (reimburse_status),
KEY idx_upload_time (upload_time)
) ENGINE=InnoDB COMMENT='报销表';
-- 菜单挂载到“办公管理”下parent_id=5
INSERT INTO sys_menu VALUES ('131', '报销管理', '5', '7', 'reimbursement', 'oms/reimbursement/index', '', 1, 0, 'C', '0', '0', 'oa:reimbursement:list', 'money', 'admin', sysdate(), '', null, '报销管理菜单');
-- 按钮权限
INSERT INTO sys_menu VALUES ('1311', '报销查询', '131', '1', '#', '', '', 1, 0, 'F', '0', '0', 'oa:reimbursement:query', '#', 'admin', sysdate(), '', null, '');
INSERT INTO sys_menu VALUES ('1312', '报销新增', '131', '2', '#', '', '', 1, 0, 'F', '0', '0', 'oa:reimbursement:add', '#', 'admin', sysdate(), '', null, '');
INSERT INTO sys_menu VALUES ('1313', '报销修改', '131', '3', '#', '', '', 1, 0, 'F', '0', '0', 'oa:reimbursement:edit', '#', 'admin', sysdate(), '', null, '');
INSERT INTO sys_menu VALUES ('1314', '报销删除', '131', '4', '#', '', '', 1, 0, 'F', '0', '0', 'oa:reimbursement:remove', '#', 'admin', sysdate(), '', null, '');
INSERT INTO sys_menu VALUES ('1315', '报销导出', '131', '5', '#', '', '', 1, 0, 'F', '0', '0', 'oa:reimbursement:export', '#', 'admin', sysdate(), '', null, '');
-- ================================
-- 工资录入/补录模块v0.8.3
-- ================================
-- 1) 计费基础配置(小时工/计件工/天工)
DROP TABLE IF EXISTS gear_wage_rate_config;
CREATE TABLE gear_wage_rate_config (
rate_id bigint(20) NOT NULL COMMENT '费率配置ID',
rate_code varchar(64) NOT NULL COMMENT '费率编码(唯一)',
rate_name varchar(128) NOT NULL COMMENT '费率名称',
billing_type char(1) NOT NULL COMMENT '计费类型1小时工 2计件工 3天工',
work_type_name varchar(64) DEFAULT '' COMMENT '工种名称(小时工/天工使用)',
item_name varchar(128) DEFAULT '' COMMENT '加工物品名称(计件工使用)',
process_name varchar(128) DEFAULT '' COMMENT '工序名称(计件工使用)',
workday_hours decimal(5,2) DEFAULT NULL COMMENT '日工时制度如8/9仅天工',
unit_price decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '单价(小时单价/件单价/日薪)',
status char(1) NOT NULL DEFAULT '0' COMMENT '状态0启用 1停用',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (rate_id),
UNIQUE KEY uk_rate_code (rate_code),
KEY idx_billing_type_status (billing_type, status),
KEY idx_work_type_name (work_type_name),
KEY idx_item_process (item_name, process_name)
) ENGINE=InnoDB COMMENT='工资费率配置表';
-- 2) 每日录入批次(用于“自动带入全员员工”和录入进度统计)
DROP TABLE IF EXISTS gear_wage_entry_batch;
CREATE TABLE gear_wage_entry_batch (
batch_id bigint(20) NOT NULL COMMENT '批次ID',
entry_date date NOT NULL COMMENT '录入日期',
total_emp_count int(11) NOT NULL DEFAULT 0 COMMENT '应录入员工总数',
entered_emp_count int(11) NOT NULL DEFAULT 0 COMMENT '已录入员工数',
unentered_emp_count int(11) NOT NULL DEFAULT 0 COMMENT '未录入员工数',
status char(1) NOT NULL DEFAULT '0' COMMENT '状态0进行中 1已完成',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (batch_id),
UNIQUE KEY uk_entry_date (entry_date),
KEY idx_status (status)
) ENGINE=InnoDB COMMENT='工资每日录入批次表';
-- 3) 每日员工录入状态(用于“已录入/未录入”检索)
DROP TABLE IF EXISTS gear_wage_entry_emp_status;
CREATE TABLE gear_wage_entry_emp_status (
status_id bigint(20) NOT NULL COMMENT '状态ID',
batch_id bigint(20) NOT NULL COMMENT '批次ID',
entry_date date NOT NULL COMMENT '录入日期',
emp_id bigint(20) NOT NULL COMMENT '员工ID',
emp_name varchar(64) NOT NULL COMMENT '员工姓名',
entered_flag char(1) NOT NULL DEFAULT '0' COMMENT '是否已录入0否 1是',
first_entry_time datetime COMMENT '首次录入时间',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (status_id),
UNIQUE KEY uk_entry_date_emp (entry_date, emp_id),
KEY idx_batch_id (batch_id),
KEY idx_entered_flag (entered_flag)
) ENGINE=InnoDB COMMENT='工资录入员工状态表';
-- 4) 工资录入明细(原始录入 + 补录)
DROP TABLE IF EXISTS gear_wage_entry_detail;
CREATE TABLE gear_wage_entry_detail (
detail_id bigint(20) NOT NULL COMMENT '明细ID',
entry_date date NOT NULL COMMENT '业务日期',
emp_id bigint(20) NOT NULL COMMENT '员工ID',
emp_name varchar(64) NOT NULL COMMENT '员工姓名',
billing_type char(1) NOT NULL COMMENT '计费类型1小时工 2计件工 3天工',
rate_id bigint(20) NOT NULL COMMENT '费率配置ID',
work_type_name varchar(64) DEFAULT '' COMMENT '工种名称(快照)',
item_name varchar(128) DEFAULT '' COMMENT '加工物品(快照)',
process_name varchar(128) DEFAULT '' COMMENT '工序(快照)',
order_no varchar(64) DEFAULT '' COMMENT '订单号(订单维度去重)',
workload decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '工作量(小时/件数/天数)',
unit_price decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '单价快照',
base_amount decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '基础金额(工作量*单价)',
extra_amount decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '额外金额(高温/交通等)',
extra_reason varchar(255) DEFAULT '' COMMENT '额外金额原因',
total_amount decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '总金额(基础+额外)',
is_makeup char(1) NOT NULL DEFAULT '0' COMMENT '是否补录0否 1是',
source_detail_id bigint(20) DEFAULT NULL COMMENT '被补录/被修改的原始明细ID',
makeup_responsible_id bigint(20) DEFAULT NULL COMMENT '补录责任人ID',
makeup_responsible varchar(64) DEFAULT '' COMMENT '补录责任人姓名',
makeup_reason varchar(500) DEFAULT '' COMMENT '补录原因',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (detail_id),
UNIQUE KEY uk_entry_unique (entry_date, emp_id, billing_type, rate_id, order_no, del_flag),
KEY idx_entry_date_emp (entry_date, emp_id),
KEY idx_is_makeup (is_makeup),
KEY idx_makeup_resp (makeup_responsible_id),
KEY idx_source_detail_id (source_detail_id),
KEY idx_order_no (order_no)
) ENGINE=InnoDB COMMENT='工资录入明细表';
-- 5) 补录操作日志(确保责任链可追溯)
DROP TABLE IF EXISTS gear_wage_makeup_log;
CREATE TABLE gear_wage_makeup_log (
log_id bigint(20) NOT NULL COMMENT '日志ID',
detail_id bigint(20) NOT NULL COMMENT '补录后明细ID',
source_detail_id bigint(20) DEFAULT NULL COMMENT '补录前明细ID',
operation_type char(1) NOT NULL DEFAULT '1' COMMENT '操作类型1新增补录 2修改补录 3撤销补录',
operation_date date NOT NULL COMMENT '补录目标日期',
emp_id bigint(20) NOT NULL COMMENT '员工ID',
makeup_responsible_id bigint(20) NOT NULL COMMENT '补录责任人ID',
makeup_responsible varchar(64) NOT NULL COMMENT '补录责任人姓名',
makeup_reason varchar(500) NOT NULL COMMENT '补录原因',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (log_id),
KEY idx_operation_date (operation_date),
KEY idx_resp_id (makeup_responsible_id),
KEY idx_emp_id (emp_id),
KEY idx_detail_id (detail_id)
) ENGINE=InnoDB COMMENT='工资补录日志表';
-- 6) 工人主数据(支持模板导入,长期复用)
DROP TABLE IF EXISTS gear_worker;
CREATE TABLE gear_worker (
worker_id bigint(20) NOT NULL COMMENT '工人ID',
worker_no varchar(64) NOT NULL COMMENT '工号',
worker_name varchar(64) NOT NULL COMMENT '姓名',
phone varchar(20) DEFAULT '' COMMENT '手机号',
default_billing_type char(1) DEFAULT '1' COMMENT '默认计费类型1小时工 2计件工 3天工',
default_work_type_name varchar(64) DEFAULT '' COMMENT '默认工种',
status char(1) NOT NULL DEFAULT '0' COMMENT '状态0在职 1离职',
del_flag char(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 2删除',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime COMMENT '更新时间',
remark varchar(500) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (worker_id),
UNIQUE KEY uk_worker_no (worker_no),
KEY idx_worker_name (worker_name),
KEY idx_status (status)
) ENGINE=InnoDB COMMENT='工人主数据表';