Compare commits

...

4 Commits

Author SHA1 Message Date
furongxin
52fc51c738 Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into frx 2025-05-17 14:39:01 +08:00
aikai
a4fba15a4a feat(smartfactory): 新增搬运组工资统计功能
- 添加 HandlingGroupAmountSpecificationsTotalNumDTO 类用于统计查询
- 在 HandlingGroupAmountSpecificationsService 接口中新增 getTotalNum 方法
- 在 HandlingGroupAmountSpecificationsServiceImpl 中实现 getTotalNum 方法
- 在 HandlingGroupAmountSpecificationsMapper 中添加 getTotalNum 方法的 SQL 查询
- 优化 HandlingGroupAmountSpecificationsPageReqVO 和 HandlingGroupAmountSpecificationsRespVO 类
- 新增 HandlingGroupUserAmountItemVO 类用于展示搬运工明细
- 在 HandlingGroupUserAmountService 接口中新增 getHandlingGroupUserAmountList 和 getByHandlingGroupAmountSpecificationsId 方法
- 在 HandlingGroupUserAmountServiceImpl 中实现新增的接口方法
- 在 HandlingGroupUserAmountMapper 中添加对应的 SQL 查询
2025-05-17 14:37:39 +08:00
furongxin
d4bda37927 Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into frx 2025-05-17 14:36:14 +08:00
aikai
8aef773086 feat(smartfactory): 新增搬运组相关功能
- 添加搬运组列表、分页、新增、修改、删除等接口
- 实现搬运组相关数据结构和持久化
- 优化搬运组工资规格关联相关功能,支持批量操作和合计数计算
- 更新员工列表接口,增加工作类型筛选功能
2025-05-16 11:59:11 +08:00
36 changed files with 1060 additions and 184 deletions

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupRespVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
import cn.iocoder.yudao.module.smartfactory.service.handlinggroup.HandlingGroupService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 搬运组")
@RestController
@RequestMapping("/smartfactory/handling-group")
@Validated
public class HandlingGroupController {
@Resource
private HandlingGroupService handlingGroupService;
@PostMapping("/create")
@Operation(summary = "创建搬运组")
public CommonResult<Long> createHandlingGroup(@Valid @RequestBody HandlingGroupSaveReqVO createReqVO) {
return success(handlingGroupService.createHandlingGroup(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新搬运组")
public CommonResult<Boolean> updateHandlingGroup(@Valid @RequestBody HandlingGroupSaveReqVO updateReqVO) {
handlingGroupService.updateHandlingGroup(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除搬运组")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteHandlingGroup(@RequestParam("id") Long id) {
handlingGroupService.deleteHandlingGroup(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得搬运组")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<HandlingGroupRespVO> getHandlingGroup(@RequestParam("id") Long id) {
HandlingGroupDO handlingGroup = handlingGroupService.getHandlingGroup(id);
return success(BeanUtils.toBean(handlingGroup, HandlingGroupRespVO.class));
}
@GetMapping("/getAllByFactoryId")
@Operation(summary = "根据工程id获得搬运组列表")
public CommonResult<List<HandlingGroupRespVO>> getAllByFactoryId(@RequestParam("factoryId") Long factoryId) {
List<HandlingGroupDO> list = handlingGroupService.list(new LambdaQueryWrapper<HandlingGroupDO>().eq(HandlingGroupDO::getFactoryId, factoryId));
return success(BeanUtils.toBean(list, HandlingGroupRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得搬运组分页")
public CommonResult<PageResult<HandlingGroupRespVO>> getHandlingGroupPage(@Valid HandlingGroupPageReqVO pageReqVO) {
PageResult<HandlingGroupDO> pageResult = handlingGroupService.getHandlingGroupPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, HandlingGroupRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运组 Excel")
@OperateLog(type = EXPORT)
public void exportHandlingGroupExcel(@Valid HandlingGroupPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<HandlingGroupDO> list = handlingGroupService.getHandlingGroupPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "搬运组.xls", "数据", HandlingGroupRespVO.class,
BeanUtils.toBean(list, HandlingGroupRespVO.class));
}
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateItemVO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@ExcelIgnoreUnannotated
public class HandlingGroupListVO {
@Schema(description = "搬运组id", example = "27617")
private Long handlingGroupId;
@Schema(description = "叉车司机id", example = "27617")
private Long staffId;
@Schema(description = "规格/数量列表")
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemList;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 搬运组分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class HandlingGroupPageReqVO extends PageParam {
@Schema(description = "工厂id", example = "5268")
private Long factoryId;
@Schema(description = "搬运组名称", example = "芋艿")
private String handlingGroupName;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 搬运组 Response VO")
@Data
@ExcelIgnoreUnannotated
public class HandlingGroupRespVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9657")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
@ExcelProperty("工厂id")
private Long factoryId;
@Schema(description = "工厂名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
@ExcelProperty("工厂名称")
private String factoryName;
@Schema(description = "搬运组名称", example = "芋艿")
@ExcelProperty("搬运组名称")
private String handlingGroupName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
@Schema(description = "管理后台 - 搬运组新增/修改 Request VO")
@Data
public class HandlingGroupSaveReqVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9657")
private Long id;
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5268")
@NotNull(message = "工厂id不能为空")
private Long factoryId;
@Schema(description = "搬运组名称", example = "芋艿")
private String handlingGroupName;
}

View File

@ -7,18 +7,18 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsRespVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsService;
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupuseramount.HandlingGroupUserAmountService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -26,13 +26,14 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 搬运组工资规格关联")
@ -43,69 +44,89 @@ public class HandlingGroupAmountSpecificationsController {
@Resource
private HandlingGroupAmountSpecificationsService handlingGroupAmountSpecificationsService;
@Resource
private HandlingGroupUserAmountService handlingGroupUserAmountService;
@Resource
private FactoryInfoService factoryInfoService;
@PostMapping("/batchCreate")
@Operation(summary = "创建搬运组工资规格关联")
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:create')")
@Operation(summary = "批量创建搬运组工资规格关联")
public CommonResult<Boolean> batchCreate(@Valid @RequestBody HandlingGroupAmountSpecificationsBatchCreateVO vo) {
handlingGroupAmountSpecificationsService.batchCreate(vo);
return success(true);
}
@GetMapping("/getTotalNum")
@Operation(summary = "获取合计数")
public CommonResult<HandlingGroupAmountSpecificationsTotalNumVO> getTotalNum(@Valid HandlingGroupAmountSpecificationsTotalNumDTO dto) {
HandlingGroupAmountSpecificationsTotalNumVO vo = handlingGroupAmountSpecificationsService.getTotalNum(dto);
return success(vo);
}
@PostMapping("/update")
@Operation(summary = "更新搬运组工资规格关联")
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:update')")
public CommonResult<Boolean> update(@Valid @RequestBody HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
handlingGroupAmountSpecificationsService.updateHandlingGroupAmountSpecifications(createReqVO);
@GetMapping("/getAmountSubtotal")
@Operation(summary = "获取金额小计")
public CommonResult<BigDecimal> getAmountSubtotal(@RequestParam Integer totalCount,
@RequestParam Long handlingSpecificationsId) {
BigDecimal amount = handlingGroupAmountSpecificationsService.getAmountSubtotal(totalCount, handlingSpecificationsId);
return success(amount);
}
@PostMapping("/batchUpdate")
@Operation(summary = "批量更新搬运组工资规格关联")
public CommonResult<Boolean> batchUpdate(@Valid @RequestBody HandlingGroupAmountSpecificationsBatchUpdateVO vo) {
handlingGroupAmountSpecificationsService.batchUpdate(vo);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除搬运组工资规格关联")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:delete')")
public CommonResult<Boolean> deleteHandlingGroupAmountSpecifications(@RequestParam("id") Long id) {
handlingGroupAmountSpecificationsService.deleteHandlingGroupAmountSpecifications(id);
@PostMapping("/batchDelete")
@Operation(summary = "批量删除搬运组工资规格关联")
public CommonResult<Boolean> batchDelete(@RequestBody HandlingGroupAmountSpecificationsBatchDelVO vo) {
handlingGroupAmountSpecificationsService.batchDelete(vo);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得搬运组工资规格关联")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:query')")
public CommonResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecifications(@RequestParam("id") Long id) {
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecifications(id);
@Parameter(name = "factoryId", description = "工厂id", required = true, example = "1024")
@Parameter(name = "dateStr", description = "日期", required = true, example = "1024")
@Parameter(name = "handlingGroupId", description = "搬运组id", required = true, example = "1024")
public CommonResult<List<HandlingGroupAmountSpecificationsRespVO>> getHandlingGroupAmountSpecifications(@RequestParam Long factoryId,
@RequestParam String dateStr,
@RequestParam Long handlingGroupId) {
List<HandlingGroupAmountSpecificationsDO> handlingGroupAmountSpecifications = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsList(factoryId, dateStr, handlingGroupId);
return success(BeanUtils.toBean(handlingGroupAmountSpecifications, HandlingGroupAmountSpecificationsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得搬运组工资规格关联分页")
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:query')")
public CommonResult<PageResult<HandlingGroupAmountSpecificationsRespVO>> getHandlingGroupAmountSpecificationsPage(@Valid HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
PageResult<HandlingGroupAmountSpecificationsDO> pageResult = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsPage(pageReqVO);
PageResult<HandlingGroupAmountSpecificationsRespVO> result = BeanUtils.toBean(pageResult, HandlingGroupAmountSpecificationsRespVO.class);
if (CollUtil.isNotEmpty(result.getList())) {
// 获取工厂信息
Set<Long> factoryIds = convertSet(result.getList(), HandlingGroupAmountSpecificationsRespVO::getFactoryId);
Map<Long, FactoryInfoDO> factoryMap = convertMap(factoryInfoService.getFactoryList(factoryIds), FactoryInfoDO::getId);
result.getList().forEach(data -> {
// 设置工厂名称
data.setFactoryName(factoryMap.get(data.getFactoryId()) != null ? factoryMap.get(data.getFactoryId()).getShortName() : null);
});
// 计算合计 - 先根据工厂+搬运组+日期进行分组
Map<String, List<HandlingGroupAmountSpecificationsRespVO>> map = result.getList().stream().collect(Collectors.groupingBy(a -> a.getFactoryId() + "_" + a.getHandlingGroupId() + "_" + a.getDateStr()));
List<Long> ids = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getId).collect(Collectors.toList());
Map<Long, List<HandlingGroupUserAmountDO>> handlingGroupUserAmountMap = new HashMap<>();
if (CollUtil.isNotEmpty(ids)) {
List<HandlingGroupUserAmountDO> list = handlingGroupUserAmountService.getByHandlingGroupAmountSpecificationsId(ids);
handlingGroupUserAmountMap = list.stream().collect(Collectors.groupingBy(HandlingGroupUserAmountDO::getHandlingGroupAmountSpecificationsId));
}
for (HandlingGroupAmountSpecificationsRespVO handlingGroupAmountSpecificationsDO : result.getList()) {
String key = handlingGroupAmountSpecificationsDO.getFactoryId() + "_" + handlingGroupAmountSpecificationsDO.getHandlingGroupId() + "_" + handlingGroupAmountSpecificationsDO.getDateStr();
handlingGroupAmountSpecificationsDO.setTotalAmount(getSumValue(map.get(key), HandlingGroupAmountSpecificationsRespVO::getAmount, BigDecimal::add));
handlingGroupAmountSpecificationsDO.setTotalNum(getSumValue(map.get(key), HandlingGroupAmountSpecificationsRespVO::getTotalCount, Integer::sum));
List<HandlingGroupUserAmountDO> items = handlingGroupUserAmountMap.get(handlingGroupAmountSpecificationsDO.getId());
if (CollUtil.isNotEmpty(items)) {
List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS = BeanUtils.toBean(items, HandlingGroupUserAmountItemVO.class);
handlingGroupAmountSpecificationsDO.setHandlingGroupUserAmountItemVOS(handlingGroupUserAmountItemVOS);
}
}
return success(result);
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运组工资规格关联 Excel")
@PreAuthorize("@ss.hasPermission('smartfactory:handling-group-amount-specifications:export')")
@OperateLog(type = EXPORT)
public void exportHandlingGroupAmountSpecificationsExcel(@Valid HandlingGroupAmountSpecificationsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
@ -113,7 +134,7 @@ public class HandlingGroupAmountSpecificationsController {
List<HandlingGroupAmountSpecificationsDO> list = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "搬运组工资规格关联.xls", "数据", HandlingGroupAmountSpecificationsRespVO.class,
BeanUtils.toBean(list, HandlingGroupAmountSpecificationsRespVO.class));
BeanUtils.toBean(list, HandlingGroupAmountSpecificationsRespVO.class));
}
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ToString(callSuper = true)
public class HandlingGroupAmountSpecificationsTotalNumDTO {
@Schema(description = "工厂id")
private Long factoryId;
@Schema(description = "规格id")
private Long handlingSpecificationsId;
@Schema(description = "叉车司机名称")
private String forkliftDriverName;
@Schema(description = "搬运工名称")
private String porterName;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -8,6 +8,10 @@ import javax.validation.constraints.NotNull;
@Data
public class HandlingGroupAmountSpecificationsBatchCreateItemVO {
@Schema(description = "id", example = "23178")
@NotNull(message = "id")
private Long id;
@Schema(description = "搬运规格id", example = "23178")
@NotNull(message = "搬运规格不能为空")
private Long handlingSpecificationsId;

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -15,6 +16,6 @@ public class HandlingGroupAmountSpecificationsBatchCreateVO {
@NotNull(message = "日期不能为空")
private String dateStr;
@Schema(description = "列表")
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemVOS;
@Schema(description = "搬运组列表")
private List<HandlingGroupListVO> handlingGroupList;
}

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class HandlingGroupAmountSpecificationsBatchDelVO {
@Schema(description = "工厂id", example = "23178")
private Long factoryId;
@Schema(description = "日期 格式 yyyy-MM-dd")
@NotNull(message = "日期不能为空")
private String dateStr;
@Schema(description = "搬运组id", example = "27617")
private Long handlingGroupId;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class HandlingGroupAmountSpecificationsBatchUpdateVO {
@Schema(description = "工厂id", example = "23178")
private Long factoryId;
@Schema(description = "日期 格式 yyyy-MM-dd")
@NotNull(message = "日期不能为空")
private String dateStr;
@Schema(description = "搬运组id", example = "27617")
private Long handlingGroupId;
@Schema(description = "叉车司机id", example = "27617")
private Long staffId;
@Schema(description = "规格/数量列表")
private List<HandlingGroupAmountSpecificationsBatchCreateItemVO> itemList;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -21,6 +22,15 @@ public class HandlingGroupAmountSpecificationsPageReqVO extends PageParam {
@Schema(description = "工厂id", example = "23178")
private Long factoryId;
@Schema(description = "搬运组id", example = "23178")
private Long handlingGroupId;
@Schema(description = "叉车司机名称", example = "23178")
private String staffName;
@Schema(description = "搬运工名称", example = "23178")
private String porterName;
@Schema(description = "搬运规格id", example = "23178")
private Long handlingSpecificationsId;

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountRespVO;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
@ -7,6 +9,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 搬运组工资规格关联 Response VO")
@Data
@ -23,6 +26,22 @@ public class HandlingGroupAmountSpecificationsRespVO {
@Schema(description = "工厂名称", example = "23178")
private String factoryName;
@Schema(description = "搬运组id", example = "23178")
@ExcelProperty("搬运组id")
private Long handlingGroupId;
@Schema(description = "搬运组名称", example = "23178")
@ExcelProperty("搬运组名称")
private String handlingGroupName;
@Schema(description = "叉车司机名称", example = "23178")
@ExcelProperty("叉车司机名称")
private String staffName;
@Schema(description = "叉车司机id", example = "23178")
@ExcelProperty("叉车司机id")
private Long staffId;
@Schema(description = "搬运规格id", example = "23178")
@ExcelProperty("搬运规格id")
private Long handlingSpecificationsId;
@ -47,4 +66,14 @@ public class HandlingGroupAmountSpecificationsRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "金额小计")
@ExcelProperty("金额小计")
private BigDecimal totalAmount;
@Schema(description = "数量小计")
@ExcelProperty("数量小计")
private Integer totalNum;
@Schema(description = "搬运工明细列表")
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
@Data
@ToString(callSuper = true)
public class HandlingGroupAmountSpecificationsTotalNumVO {
@Schema(description = "数量")
private Long num;
@Schema(description = "总金额")
private BigDecimal amount;
}

View File

@ -85,6 +85,13 @@ public class HandlingGroupUserAmountController {
return success(BeanUtils.toBean(pageResult, HandlingGroupUserAmountRespVO.class));
}
@GetMapping("/listAll")
@Operation(summary = "获得搬运组每日个人工资记录列表")
public CommonResult<List<HandlingGroupUserAmountRespVO>> getHandlingGroupUserAmountList(@Valid HandlingGroupUserAmountPageReqVO pageReqVO) {
List<HandlingGroupUserAmountDO> list = handlingGroupUserAmountService.getHandlingGroupUserAmountList(pageReqVO);
return success(BeanUtils.toBean(list, HandlingGroupUserAmountRespVO.class));
}
@GetMapping("/staffWagesPage")
@Operation(summary = "以用户分组工资分页列表")
public CommonResult<PageResult<StaffWagesPageVO>> staffWagesPage(@Valid StaffWagesPageDTO dto) {

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@ExcelIgnoreUnannotated
public class HandlingGroupUserAmountItemVO {
@Schema(description = "用户id", example = "12639")
@ExcelProperty("用户id")
private Long userId;
@Schema(description = "用户名称", example = "12639")
@ExcelProperty("用户名称")
private String userName;
@Schema(description = "搬运组每日个人工资")
@ExcelProperty("搬运组每日个人工资")
private BigDecimal amount;
}

View File

@ -22,6 +22,9 @@ public class HandlingGroupUserAmountPageReqVO extends PageParam {
@Schema(description = "搬运组工资规格关联id", example = "27617")
private Long handlingGroupAmountSpecificationsId;
@Schema(description = "搬运组id", example = "27617")
private Long handlingGroupId;
@Schema(description = "日期 格式 yyyy-MM-dd")
private String dateStr;

View File

@ -55,7 +55,6 @@ public class StaffController {
@PostMapping("/create")
@Operation(summary = "创建员工")
@PreAuthorize("@ss.hasPermission('factory:staff:create')")
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSaveReqVO createReqVO) {
return success(staffService.createStaff(createReqVO));
}
@ -68,7 +67,6 @@ public class StaffController {
@PutMapping("/update")
@Operation(summary = "更新员工")
@PreAuthorize("@ss.hasPermission('factory:staff:update')")
public CommonResult<Boolean> updateStaff(@Valid @RequestBody StaffSaveReqVO updateReqVO) {
staffService.updateStaff(updateReqVO);
return success(true);
@ -76,7 +74,6 @@ public class StaffController {
@PutMapping("/update-salary")
@Operation(summary = "更新员工")
@PreAuthorize("@ss.hasPermission('factory:staff:update')")
public CommonResult<Boolean> updateStaffSalary(@RequestBody StaffSalaryUpdateVO updateReqVO) {
staffService.updateStaffSalary(updateReqVO);
return success(true);
@ -85,7 +82,6 @@ public class StaffController {
@DeleteMapping("/delete")
@Operation(summary = "删除员工")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('factory:staff:delete')")
public CommonResult<Boolean> deleteStaff(@RequestParam("id") Long id) {
staffService.deleteStaff(id);
return success(true);
@ -94,7 +90,6 @@ public class StaffController {
@GetMapping("/get")
@Operation(summary = "获得员工")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
public CommonResult<StaffDO> getStaff(@RequestParam("id") Long id) {
StaffDO staff = staffService.getStaff(id);
return success(staff);
@ -104,7 +99,6 @@ public class StaffController {
@Operation(summary = "获得指定厂区得员工")
@Parameter(name = "factoryId", description = "厂区编号", required = true, example = "1024")
@Parameter(name = "isIn", description = "是否获取该厂区得员工", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
public CommonResult<List<StaffRespVO>> getListByFactory(@RequestParam("factoryId") Long factoryId,
@RequestParam("isIn") Boolean isIn) {
List<StaffDO> staffs = staffService.getListByFactory(factoryId, isIn);
@ -115,14 +109,14 @@ public class StaffController {
@GetMapping("/getListByFactoryId")
@Operation(summary = "获得指定厂员工")
public CommonResult<List<StaffRespVO>> getListByFactoryId(@RequestParam("factoryId") Long factoryId,
@RequestParam(value = "nickName", required = false) String nickName) {
List<StaffDO> staffs = staffService.getListByFactoryId(factoryId, nickName);
@RequestParam(value = "nickName", required = false) String nickName,
@RequestParam(value = "workTypeId", required = false) Long workTypeId) {
List<StaffDO> staffs = staffService.getListByFactoryId(factoryId, nickName, workTypeId);
return success(BeanUtils.toBean(staffs, StaffRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得员工分页")
@PreAuthorize("@ss.hasPermission('factory:staff:query')")
public CommonResult<PageResult<StaffRespVO>> getStaffPage(@Valid StaffPageReqVO pageReqVO) {
PageResult<StaffDO> pageResult = staffService.getStaffPage(pageReqVO);
PageResult<StaffRespVO> result = BeanUtils.toBean(pageResult, StaffRespVO.class);
@ -142,7 +136,6 @@ public class StaffController {
@GetMapping("/export-excel")
@Operation(summary = "导出员工 Excel")
@PreAuthorize("@ss.hasPermission('factory:staff:export')")
@OperateLog(type = EXPORT)
public void exportStaffExcel(@Valid StaffPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
@ -192,7 +185,6 @@ public class StaffController {
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
})
@PreAuthorize("@ss.hasPermission('factory:staff:import')")
public CommonResult<StaffImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
List<StaffImportExcelVO> list = ExcelUtils.read(file, StaffImportExcelVO.class);

View File

@ -39,14 +39,12 @@ public class StaffSalaryController {
@PostMapping("/create")
@Operation(summary = "创建员工工资")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:create')")
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSalarySaveReqVO createReqVO) {
return success(staffSalaryService.createStaffSalary(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新厂区员工工资")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:update')")
public CommonResult<Boolean> updateStaffSalary(@Valid @RequestBody StaffSalarySaveReqVO updateReqVO) {
staffSalaryService.updateStaffSalary(updateReqVO);
return success(true);
@ -54,7 +52,6 @@ public class StaffSalaryController {
@PutMapping("/update-status")
@Operation(summary = "更新厂区员工工资状态")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:update')")
public CommonResult<Boolean> updateStatus(@RequestBody StaffSalarySaveReqVO updateReqVO) {
staffSalaryService.updateStatus(updateReqVO);
return success(true);
@ -63,7 +60,6 @@ public class StaffSalaryController {
@DeleteMapping("/delete")
@Operation(summary = "删除厂区员工工资")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:delete')")
public CommonResult<Boolean> deleteStaffSalary(@RequestParam("id") Long id) {
staffSalaryService.deleteStaffSalary(id);
return success(true);
@ -72,7 +68,6 @@ public class StaffSalaryController {
@GetMapping("/get")
@Operation(summary = "获得厂区员工工资")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
public CommonResult<StaffSalaryRespVO> getStaffSalary(@RequestParam("id") Long id) {
StaffSalaryDO staffSalary = staffSalaryService.getStaffSalary(id);
@ -81,7 +76,6 @@ public class StaffSalaryController {
@GetMapping("/page")
@Operation(summary = "获得厂区员工工资分页")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
public CommonResult<PageResult<StaffSalaryRespVO>> getStaffSalaryPage(@Valid StaffSalaryPageReqVO pageReqVO) {
PageResult<StaffSalaryRespVO> pageResult = staffSalaryService.getStaffSalaryPage(pageReqVO);
return success(pageResult);
@ -89,7 +83,6 @@ public class StaffSalaryController {
@GetMapping("/total")
@Operation(summary = "获取工资统计")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:query')")
public CommonResult<SalaryTotalVO> getStaffSalaryTotal(@Valid StaffSalaryPageReqVO pageReqVO) {
return success(staffSalaryService.getStaffSalaryTotal(pageReqVO));
@ -97,7 +90,6 @@ public class StaffSalaryController {
@GetMapping("/export-excel")
@Operation(summary = "导出厂区员工工资 Excel")
@PreAuthorize("@ss.hasPermission('smartfactory:staff-salary:export')")
@OperateLog(type = EXPORT)
public void exportStaffSalaryExcel(@Valid StaffSalaryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
@ -107,4 +99,4 @@ public class StaffSalaryController {
ExcelUtils.write(response, "厂区员工工资.xls", "数据", StaffSalaryRespVO.class,
list);
}
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 搬运组 DO
*
* @author 艾楷
*/
@TableName("sf_handling_group")
@KeySequence("sf_handling_group_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HandlingGroupDO extends BaseDO {
/**
* 主键id
*/
@TableId
private Long id;
/**
* 工厂id
*/
private Long factoryId;
/**
* 搬运组名称
*/
private String handlingGroupName;
@TableField(exist = false)
private String factoryName;
}

View File

@ -39,9 +39,16 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
* 搬运规格id
*/
private Long handlingSpecificationsId;
/**
* 搬运组id
*/
private Long handlingGroupId;
/**
* 叉车司机id
*/
private Long staffId;
@TableField(exist = false)
private String handlingSpecificationsName;
/**
* 数量
*/
@ -55,4 +62,25 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
*/
private BigDecimal amount;
/**
* 工厂名称
*/
@TableField(exist = false)
private String factoryName;
/**
* 搬运组名称
*/
@TableField(exist = false)
private String handlingGroupName;
/**
* 叉车司机名称
*/
@TableField(exist = false)
private String staffName;
/**
* 搬运规格名称
*/
@TableField(exist = false)
private String handlingSpecificationsName;
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
@ -44,6 +45,12 @@ public class HandlingGroupUserAmountDO extends BaseDO {
* 搬运组工资规格关联id
*/
private Long handlingGroupAmountSpecificationsId;
/**
* 搬运组id
*/
private Long handlingGroupId;
/**
* 工厂id
*/

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* 搬运组 Mapper
*
* @author 艾楷
*/
@Mapper
public interface HandlingGroupMapper extends BaseMapperX<HandlingGroupDO> {
default PageResult<HandlingGroupDO> selectPage(HandlingGroupPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HandlingGroupDO>()
.eqIfPresent(HandlingGroupDO::getFactoryId, reqVO.getFactoryId())
.likeIfPresent(HandlingGroupDO::getHandlingGroupName, reqVO.getHandlingGroupName())
.betweenIfPresent(HandlingGroupDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(HandlingGroupDO::getId));
}
/**
*
* @param page
* @param vo
* @return
*/
IPage<HandlingGroupDO> selectPageList(@Param("page") Page<Object> page, @Param("vo") HandlingGroupPageReqVO vo);
}

View File

@ -3,13 +3,17 @@ package cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecif
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsTotalNumVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 搬运组工资规格关联 Mapper
*
@ -44,4 +48,22 @@ public interface HandlingGroupAmountSpecificationsMapper extends BaseMapperX<Han
* @return
*/
HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(@Param("id") Long id);
/**
* 获取详情 多条
*
* @param factoryId
* @param dateStr
* @param handlingGroupId
* @return
*/
List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(@Param("factoryId") Long factoryId, @Param("dateStr") String dateStr, @Param("handlingGroupId") Long handlingGroupId);
/**
* 获取总金额
*
* @param dto
* @return
*/
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(@Param("dto") HandlingGroupAmountSpecificationsTotalNumDTO dto);
}

View File

@ -58,4 +58,18 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
* @return
*/
List<Map<String, Object>> getListByMonth(@Param("id") Long id, @Param("factoryId") Long factoryId, @Param("dateList") List<String> dateList, @Param("name") String name);
/**
* 列表
* @param vo
* @return
*/
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(@Param("vo") HandlingGroupUserAmountPageReqVO vo);
/**
*
* @param handlingGroupAmountSpecificationsIds
* @return
*/
List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(@Param("handlingGroupAmountSpecificationsIds") List<Long> handlingGroupAmountSpecificationsIds);
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.smartfactory.service.handlinggroup;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.*;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 搬运组 Service 接口
*
* @author 艾楷
*/
public interface HandlingGroupService extends IService<HandlingGroupDO> {
/**
* 创建搬运组
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createHandlingGroup(@Valid HandlingGroupSaveReqVO createReqVO);
/**
* 更新搬运组
*
* @param updateReqVO 更新信息
*/
void updateHandlingGroup(@Valid HandlingGroupSaveReqVO updateReqVO);
/**
* 删除搬运组
*
* @param id 编号
*/
void deleteHandlingGroup(Long id);
/**
* 获得搬运组
*
* @param id 编号
* @return 搬运组
*/
HandlingGroupDO getHandlingGroup(Long id);
/**
* 获得搬运组分页
*
* @param pageReqVO 分页查询
* @return 搬运组分页
*/
PageResult<HandlingGroupDO> getHandlingGroupPage(HandlingGroupPageReqVO pageReqVO);
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.smartfactory.service.handlinggroup;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup.HandlingGroupMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
/**
* 搬运组 Service 实现类
*
* @author 艾楷
*/
@Service
@Validated
public class HandlingGroupServiceImpl extends ServiceImpl<HandlingGroupMapper, HandlingGroupDO> implements HandlingGroupService {
@Resource
private HandlingGroupMapper handlingGroupMapper;
@Override
public Long createHandlingGroup(HandlingGroupSaveReqVO createReqVO) {
// 插入
HandlingGroupDO handlingGroup = BeanUtils.toBean(createReqVO, HandlingGroupDO.class);
handlingGroupMapper.insert(handlingGroup);
// 返回
return handlingGroup.getId();
}
@Override
public void updateHandlingGroup(HandlingGroupSaveReqVO updateReqVO) {
// 更新
HandlingGroupDO updateObj = BeanUtils.toBean(updateReqVO, HandlingGroupDO.class);
handlingGroupMapper.updateById(updateObj);
}
@Override
public void deleteHandlingGroup(Long id) {
// 删除
handlingGroupMapper.deleteById(id);
}
@Override
public HandlingGroupDO getHandlingGroup(Long id) {
return handlingGroupMapper.selectById(id);
}
@Override
public PageResult<HandlingGroupDO> getHandlingGroupPage(HandlingGroupPageReqVO pageReqVO) {
IPage<HandlingGroupDO> pageResult = handlingGroupMapper.selectPageList(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
}
}

View File

@ -1,12 +1,13 @@
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
/**
* 搬运组工资规格关联 Service 接口
@ -15,28 +16,6 @@ import javax.validation.Valid;
*/
public interface HandlingGroupAmountSpecificationsService {
/**
* 创建搬运组工资规格关联
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createHandlingGroupAmountSpecifications(@Valid HandlingGroupAmountSpecificationsSaveReqVO createReqVO);
/**
* 更新搬运组工资规格关联
*
* @param updateReqVO 更新信息
*/
void updateHandlingGroupAmountSpecifications(@Valid HandlingGroupAmountSpecificationsSaveReqVO updateReqVO);
/**
* 删除搬运组工资规格关联
*
* @param id 编号
*/
void deleteHandlingGroupAmountSpecifications(Long id);
/**
* 获得搬运组工资规格关联
*
@ -45,6 +24,16 @@ public interface HandlingGroupAmountSpecificationsService {
*/
HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(Long id);
/**
* 获取详情 - 多条
*
* @param factoryId
* @param dateStr
* @param handlingGroupId
* @return
*/
List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(Long factoryId, String dateStr, Long handlingGroupId);
/**
* 获得搬运组工资规格关联分页
*
@ -53,16 +42,40 @@ public interface HandlingGroupAmountSpecificationsService {
*/
PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO);
/**
* 新增编辑
*
* @param createReqVO
*/
void createOrEdit(@Valid HandlingGroupAmountSpecificationsSaveReqVO createReqVO);
/**
* 批量新增
*
* @param vo
*/
void batchCreate(@Valid HandlingGroupAmountSpecificationsBatchCreateVO vo);
/**
* 批量更新
*
* @param vo
*/
void batchUpdate(@Valid HandlingGroupAmountSpecificationsBatchUpdateVO vo);
/**
* 批量删除
*
* @param vo
*/
void batchDelete(HandlingGroupAmountSpecificationsBatchDelVO vo);
/**
* 获取合计
*
* @param factoryId
* @return
*/
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto);
/**
* 获取金额小计
* @param totalCount
* @param handlingSpecificationsId
* @return
*/
BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId);
}

View File

@ -1,12 +1,10 @@
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateItemVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsBatchCreateVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsTotalNumDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.*;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsMapper;
@ -18,7 +16,6 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
@ -28,9 +25,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION;
/**
* 搬运组工资规格关联 Service 实现类
@ -54,49 +49,17 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
private static final BigDecimal THOUSANDTH = new BigDecimal("0.001");
@Override
public Long createHandlingGroupAmountSpecifications(HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
// 插入
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(createReqVO, HandlingGroupAmountSpecificationsDO.class);
handlingGroupAmountSpecificationsMapper.insert(handlingGroupAmountSpecifications);
// 返回
return handlingGroupAmountSpecifications.getId();
}
@Override
public void updateHandlingGroupAmountSpecifications(HandlingGroupAmountSpecificationsSaveReqVO updateReqVO) {
// 更新
HandlingGroupAmountSpecificationsDO updateObj = BeanUtils.toBean(updateReqVO, HandlingGroupAmountSpecificationsDO.class);
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(updateObj.getHandlingSpecificationsId());
if (handlingSpecificationsDO == null) {
throw exception(CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION);
}
BigDecimal totalAmount;
if (handlingSpecificationsDO.getType() == 0) {
totalAmount = new BigDecimal(updateReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
} else {
totalAmount = new BigDecimal(updateReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
}
// 插入
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(updateReqVO, HandlingGroupAmountSpecificationsDO.class);
handlingGroupAmountSpecifications.setAmount(totalAmount);
handlingGroupAmountSpecificationsMapper.updateById(updateObj);
}
@Override
public void deleteHandlingGroupAmountSpecifications(Long id) {
// 删除
handlingGroupAmountSpecificationsMapper.deleteById(id);
}
@Override
public HandlingGroupAmountSpecificationsDO getHandlingGroupAmountSpecifications(Long id) {
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecifications(id);
}
@Override
public List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(Long factoryId, String dateStr, Long handlingGroupId) {
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsList(factoryId, dateStr, handlingGroupId);
}
@Override
public PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
// 判断当前登录人是否属于工厂主管
@ -110,53 +73,106 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void createOrEdit(HandlingGroupAmountSpecificationsSaveReqVO createReqVO) {
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(createReqVO.getHandlingSpecificationsId());
if (handlingSpecificationsDO == null) {
throw exception(CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION);
}
BigDecimal totalAmount;
if (handlingSpecificationsDO.getType() == 0) {
totalAmount = new BigDecimal(createReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
} else {
totalAmount = new BigDecimal(createReqVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
}
// 插入
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecifications = BeanUtils.toBean(createReqVO, HandlingGroupAmountSpecificationsDO.class);
handlingGroupAmountSpecifications.setAmount(totalAmount);
handlingGroupAmountSpecificationsMapper.insertOrUpdate(handlingGroupAmountSpecifications);
}
@Override
public void batchCreate(HandlingGroupAmountSpecificationsBatchCreateVO vo) {
List<HandlingGroupAmountSpecificationsDO> list = new ArrayList<>();
List<Long> handlingSpecificationsIds = vo.getItemVOS().stream().map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId).collect(Collectors.toList());
// -- 获取到所有的规格列表
List<Long> handlingSpecificationsIds = vo.getHandlingGroupList().stream()
.flatMap(group -> group.getItemList().stream())
.map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId)
.collect(Collectors.toList());
List<HandlingSpecificationsDO> handlingSpecificationsDOS = handlingSpecificationsService.list(new LambdaQueryWrapper<HandlingSpecificationsDO>()
.in(HandlingSpecificationsDO::getId, handlingSpecificationsIds));
Map<Long, HandlingSpecificationsDO> map = handlingSpecificationsDOS.stream().collect(Collectors.toMap(HandlingSpecificationsDO::getId, item -> item));
for (HandlingGroupAmountSpecificationsBatchCreateItemVO itemVO : vo.getItemVOS()) {
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecificationsDO = new HandlingGroupAmountSpecificationsDO();
for (HandlingGroupListVO handlingGroupListVO : vo.getHandlingGroupList()) {
for (HandlingGroupAmountSpecificationsBatchCreateItemVO itemVO : handlingGroupListVO.getItemList()) {
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecificationsDO = new HandlingGroupAmountSpecificationsDO();
BigDecimal totalAmount;
HandlingSpecificationsDO handlingSpecificationsDO = map.get(itemVO.getHandlingSpecificationsId());
if (handlingSpecificationsDO == null) {
continue;
}
if (handlingSpecificationsDO.getType() == 0) {
totalAmount = new BigDecimal(itemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
} else {
totalAmount = new BigDecimal(itemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
}
handlingGroupAmountSpecificationsDO.setFactoryId(vo.getFactoryId());
handlingGroupAmountSpecificationsDO.setDateStr(vo.getDateStr());
handlingGroupAmountSpecificationsDO.setHandlingSpecificationsId(itemVO.getHandlingSpecificationsId());
handlingGroupAmountSpecificationsDO.setAmount(totalAmount);
handlingGroupAmountSpecificationsDO.setTotalCount(itemVO.getTotalCount());
handlingGroupAmountSpecificationsDO.setHandlingGroupId(handlingGroupListVO.getHandlingGroupId());
handlingGroupAmountSpecificationsDO.setStaffId(handlingGroupListVO.getStaffId());
list.add(handlingGroupAmountSpecificationsDO);
}
}
handlingGroupAmountSpecificationsMapper.insertBatch(list);
}
@Override
public void batchUpdate(HandlingGroupAmountSpecificationsBatchUpdateVO vo) {
// 先通过 工厂 + 日期 + 组id 获取到当前编辑的搬运组
List<HandlingGroupAmountSpecificationsDO> list = handlingGroupAmountSpecificationsMapper.selectList(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
.eq(HandlingGroupAmountSpecificationsDO::getHandlingGroupId, vo.getHandlingGroupId())
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
List<Long> handlingSpecificationsIds = vo.getItemList().stream().map(HandlingGroupAmountSpecificationsBatchCreateItemVO::getHandlingSpecificationsId).distinct().collect(Collectors.toList());
List<HandlingSpecificationsDO> handlingSpecificationsDOS = handlingSpecificationsService.list(new LambdaQueryWrapper<HandlingSpecificationsDO>()
.in(HandlingSpecificationsDO::getId, handlingSpecificationsIds));
Map<Long, HandlingSpecificationsDO> map = handlingSpecificationsDOS.stream().collect(Collectors.toMap(HandlingSpecificationsDO::getId, item -> item));
Map<Long, HandlingGroupAmountSpecificationsBatchCreateItemVO> handlingGroupAmountSpecificationsMap = vo.getItemList().stream()
.collect(Collectors.toMap(HandlingGroupAmountSpecificationsBatchCreateItemVO::getId, item -> item));
for (HandlingGroupAmountSpecificationsDO item : list) {
BigDecimal totalAmount;
HandlingSpecificationsDO handlingSpecificationsDO = map.get(itemVO.getHandlingSpecificationsId());
HandlingGroupAmountSpecificationsBatchCreateItemVO handlingGroupAmountSpecificationsBatchCreateItemVO
= handlingGroupAmountSpecificationsMap.get(item.getId());
item.setHandlingSpecificationsId(handlingGroupAmountSpecificationsBatchCreateItemVO.getHandlingSpecificationsId());
HandlingSpecificationsDO handlingSpecificationsDO = map.get(item.getHandlingSpecificationsId());
if (handlingSpecificationsDO == null) {
continue;
}
if (handlingSpecificationsDO.getType() == 0) {
totalAmount = new BigDecimal(itemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
} else {
totalAmount = new BigDecimal(itemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
}
handlingGroupAmountSpecificationsDO.setFactoryId(vo.getFactoryId());
handlingGroupAmountSpecificationsDO.setDateStr(vo.getDateStr());
handlingGroupAmountSpecificationsDO.setHandlingSpecificationsId(itemVO.getHandlingSpecificationsId());
handlingGroupAmountSpecificationsDO.setAmount(totalAmount);
handlingGroupAmountSpecificationsDO.setTotalCount(itemVO.getTotalCount());
list.add(handlingGroupAmountSpecificationsDO);
item.setAmount(totalAmount);
item.setTotalCount(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount());
item.setStaffId(vo.getStaffId());
}
handlingGroupAmountSpecificationsMapper.insertBatch(list);
handlingGroupAmountSpecificationsMapper.updateBatch(list);
}
@Override
public void batchDelete(HandlingGroupAmountSpecificationsBatchDelVO vo) {
handlingGroupAmountSpecificationsMapper.delete(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
.eq(HandlingGroupAmountSpecificationsDO::getHandlingGroupId, vo.getHandlingGroupId())
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
}
@Override
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto) {
return handlingGroupAmountSpecificationsMapper.getTotalNum(dto);
}
@Override
public BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId) {
HandlingSpecificationsDO handlingSpecificationsDO = handlingSpecificationsService.getById(handlingSpecificationsId);
BigDecimal totalAmount;
if (handlingSpecificationsDO.getType() == 0) {
totalAmount = new BigDecimal(totalCount.toString()).multiply(handlingSpecificationsDO.getUnitPrice());
} else {
totalAmount = new BigDecimal(totalCount.toString()).multiply(handlingSpecificationsDO.getWeight())
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
}
return totalAmount;
}
}

View File

@ -7,15 +7,17 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseram
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountSaveReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.StaffWagesPageVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
* 搬运组每日个人工资记录 Service 接口
*
* @author 艾楷
*/
public interface HandlingGroupUserAmountService {
public interface HandlingGroupUserAmountService extends IService<HandlingGroupUserAmountDO> {
/**
* 创建搬运组每日个人工资记录
@ -79,4 +81,18 @@ public interface HandlingGroupUserAmountService {
* @return
*/
HandlingGroupUserAmountMonthVO getListByMonth(Long id, Long factoryId, Integer type, String time, String name);
/**
* 列表
* @param pageReqVO
* @return
*/
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(HandlingGroupUserAmountPageReqVO pageReqVO);
/**
*
* @param handlingGroupAmountSpecificationsIds
* @return
*/
List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(List<Long> handlingGroupAmountSpecificationsIds);
}

View File

@ -11,16 +11,14 @@ import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramou
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsMapper;
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupuseramount.HandlingGroupUserAmountMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 搬运组每日个人工资记录 Service 实现类
@ -29,7 +27,7 @@ import java.util.Map;
*/
@Service
@Validated
public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmountService {
public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGroupUserAmountMapper,HandlingGroupUserAmountDO> implements HandlingGroupUserAmountService {
@Resource
private HandlingGroupUserAmountMapper handlingGroupUserAmountMapper;
@ -136,5 +134,15 @@ public class HandlingGroupUserAmountServiceImpl implements HandlingGroupUserAmou
return vo;
}
@Override
public List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(HandlingGroupUserAmountPageReqVO pageReqVO) {
return handlingGroupUserAmountMapper.getHandlingGroupUserAmountList(pageReqVO);
}
@Override
public List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(List<Long> handlingGroupAmountSpecificationsIds) {
return handlingGroupUserAmountMapper.getByHandlingGroupAmountSpecificationsId(handlingGroupAmountSpecificationsIds);
}
}

View File

@ -112,9 +112,10 @@ public interface StaffService {
*
* @param factoryId
* @param nickName
* @param workTypeId
* @return
*/
List<StaffDO> getListByFactoryId(Long factoryId, String nickName);
List<StaffDO> getListByFactoryId(Long factoryId, String nickName, Long workTypeId);
/**
*

View File

@ -72,6 +72,14 @@ public class StaffServiceImpl implements StaffService {
throw exception(STAFF_NOT_EXISTS);
}
// 校验用户名身份证号是否已经存在
Long cunt = staffMapper.selectCount(new LambdaQueryWrapperX<StaffDO>()
.neIfPresent(StaffDO::getId, updateReqVO.getId())
.eqIfPresent(StaffDO::getIdCard, updateReqVO.getIdCard()));
if (cunt > 0) {
throw exception(USER_USERNAME_EXISTS);
}
// 身份证号是否已经存在
validateUserForCreate(null, null, null, updateReqVO.getIdCard());
@ -254,9 +262,10 @@ public class StaffServiceImpl implements StaffService {
}
@Override
public List<StaffDO> getListByFactoryId(Long factoryId, String nickName) {
public List<StaffDO> getListByFactoryId(Long factoryId, String nickName, Long workTypeId) {
return staffMapper.selectList(new LambdaQueryWrapperX<StaffDO>()
.eq(factoryId != null, StaffDO::getFactoryId, factoryId)
.eq(workTypeId != null, StaffDO::getWorkTypeId, workTypeId)
.like(StrUtil.isNotEmpty(nickName), StaffDO::getNickName, nickName));
}

View File

@ -0,0 +1,28 @@
<?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="cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup.HandlingGroupMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectPageList"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO">
select
a.*,
b.short_name as factoryName
from sf_handling_group a
left join sf_factory_info as b on a.factory_id = b.id
<where>
<if test="vo.factoryId != null">
and a.factory_id = #{vo.factoryId}
</if>
<if test="vo.handlingGroupName != null and vo.handlingGroupName != ''">
and a.handling_group_name like concat('%', #{vo.handlingGroupName}, '%')
</if>
</where>
</select>
</mapper>

View File

@ -12,22 +12,49 @@
<select id="getHandlingGroupAmountSpecificationsPage"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO">
SELECT a.*,
b.specifications_name as handlingSpecificationsName
b.specifications_name as handlingSpecificationsName,
c.nick_name as staffName,
f.short_name as factoryName,
d.handling_group_name as handlingGroupName
FROM sf_handling_group_amount_specifications AS a
left join sf_factory_info as f on a.factory_id = f.id
LEFT JOIN sf_handling_specifications AS b ON a.handling_specifications_id = b.id
LEFT JOIN sf_staff AS c ON c.id = a.staff_id
left join sf_handling_group as d on a.handling_group_id = d.id
<if test="vo.porterName != null and vo.porterName != ''">
left join sf_handling_group_user_amount as e on a.id = e.handling_group_amount_specifications_id
left join sf_staff as g on g.id = e.user_id
</if>
<where>
a.deleted = 0
and b.deleted = 0
<if test="vo.handlingSpecificationsId != null">
AND a.handling_specifications_id = #{vo.handlingSpecificationsId}
</if>
<if test="vo.handlingGroupId != null">
and a.handling_group_id = #{vo.handlingGroupId}
</if>
<if test="vo.staffName != null and vo.staffName != ''">
and c.nick_name like concat('%', #{vo.staffName}, '%')
</if>
<if test="vo.factoryId != null">
AND a.factory_id = #{vo.factoryId}
</if>
<if test="vo.dateStr != null and vo.dateStr != ''">
and a.date_str like concat('%', #{vo.dateStr}, '%')
<if test="vo.porterName != null and vo.porterName != ''">
and g.nick_name like concat('%', #{vo.porterName}, '%')
</if>
<if test="vo.createTime != null and vo.createTime.length > 0">
<if test="vo.createTime[0] != null">
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) &gt;= #{vo.createTime[0]}
</if>
<if test="vo.createTime[1] != null">
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) &lt;= #{vo.createTime[1]}
</if>
</if>
</where>
<if test="vo.porterName != null and vo.porterName != ''">
group by a.id
</if>
</select>
<select id="getHandlingGroupAmountSpecifications"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO">
@ -41,4 +68,63 @@
and a.id = #{id}
</where>
</select>
<select id="getHandlingGroupAmountSpecificationsList"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO">
SELECT a.*,
b.specifications_name as handlingSpecificationsName,
c.nick_name as staffName,
f.short_name as factoryName,
d.handling_group_name as handlingGroupName
FROM sf_handling_group_amount_specifications AS a
left join sf_factory_info as f on a.factory_id = f.id
LEFT JOIN sf_handling_specifications AS b ON a.handling_specifications_id = b.id
LEFT JOIN sf_staff AS c ON c.id = a.staff_id
left join sf_handling_group as d on a.handling_group_id = d.id
<where>
a.deleted = 0
and b.deleted = 0
<if test="handlingGroupId != null">
and a.handling_group_id = #{handlingGroupId}
</if>
<if test="factoryId != null">
AND a.factory_id = #{factoryId}
</if>
<if test="dateStr != null and dateStr != ''">
and a.date_str like concat('%', #{dateStr}, '%')
</if>
</where>
</select>
<select id="getTotalNum"
resultType="cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsTotalNumVO">
select
sum(a.total_count) as num,
sum(a.amount) as amount
from sf_handling_group_amount_specifications AS a
left join sf_staff as b on a.staff_id = b.id
left join sf_handling_group_user_amount as c on a.id = c.handling_group_amount_specifications_id
left join sf_staff as d on d.id = c.user_id
<where>
a.deleted = 0
<if test="dto.factoryId != null">
and a.factory_id = #{dto.factoryId}
</if>
<if test="dto.handlingSpecificationsId != null">
and a.handling_specifications_id = #{dto.handlingSpecificationsId}
</if>
<if test="dto.forkliftDriverName != null and dto.forkliftDriverName != ''">
and b.nick_name like concat('%', #{dto.forkliftDriverName}, '%')
</if>
<if test="dto.porterName != null and dto.porterName != ''">
and d.nick_name like concat('%', #{dto.porterName}, '%')
</if>
<if test="dto.createTime != null and dto.createTime.length > 0">
<if test="dto.createTime[0] != null">
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) &gt;= #{dto.createTime[0]}
</if>
<if test="dto.createTime[1] != null">
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) &lt;= #{dto.createTime[1]}
</if>
</if>
</where>
</select>
</mapper>

View File

@ -21,6 +21,9 @@
<if test="vo.userId != null">
AND a.user_id = #{vo.userId}
</if>
<if test="vo.handlingGroupId != null">
AND a.handling_group_id = #{vo.handlingGroupId}
</if>
<if test="vo.handlingGroupAmountSpecificationsId != null">
AND a.handling_group_amount_specifications_id= #{vo.handlingGroupAmountSpecificationsId}
</if>
@ -98,4 +101,52 @@
GROUP BY
a.user_id;
</select>
<select id="getHandlingGroupUserAmountList"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO">
SELECT a.*,
b.nick_name as userName
FROM sf_handling_group_user_amount as a
LEFT JOIN sf_staff as b on a.user_id = b.id
<where>
a.deleted = 0
and b.deleted = 0
<if test="vo.userId != null">
AND a.user_id = #{vo.userId}
</if>
<if test="vo.handlingGroupId != null">
AND a.handling_group_id = #{vo.handlingGroupId}
</if>
<if test="vo.handlingGroupAmountSpecificationsId != null">
AND a.handling_group_amount_specifications_id= #{vo.handlingGroupAmountSpecificationsId}
</if>
<if test="vo.dateStr != null and vo.dateStr != ''">
and a.dateStr like concat('%', #{vo.dateStr}, '%')
</if>
<if test="vo.createTime != null and vo.createTime.length > 0">
<if test="vo.createTime[0] != null">
and a.create_time &gt;= #{vo.createTime[0]}
</if>
<if test="vo.createTime[1] != null">
and a.create_time &lt;= #{vo.createTime[1]}
</if>
</if>
</where>
</select>
<select id="getByHandlingGroupAmountSpecificationsId"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO">
select a.*,
b.nick_name as userName
FROM sf_handling_group_user_amount as a
LEFT JOIN sf_staff as b on a.user_id = b.id
<where>
a.deleted = 0
and b.deleted = 0
<if test="handlingGroupAmountSpecificationsIds != null and handlingGroupAmountSpecificationsIds.size() > 0">
and a.handling_group_amount_specifications_id in
<foreach collection="handlingGroupAmountSpecificationsIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
</mapper>