feat(smartfactory): 新增搬运组工资统计功能
- 添加 HandlingGroupAmountSpecificationsTotalNumDTO 类用于统计查询 - 在 HandlingGroupAmountSpecificationsService 接口中新增 getTotalNum 方法 - 在 HandlingGroupAmountSpecificationsServiceImpl 中实现 getTotalNum 方法 - 在 HandlingGroupAmountSpecificationsMapper 中添加 getTotalNum 方法的 SQL 查询 - 优化 HandlingGroupAmountSpecificationsPageReqVO 和 HandlingGroupAmountSpecificationsRespVO 类 - 新增 HandlingGroupUserAmountItemVO 类用于展示搬运工明细 - 在 HandlingGroupUserAmountService 接口中新增 getHandlingGroupUserAmountList 和 getByHandlingGroupAmountSpecificationsId 方法 - 在 HandlingGroupUserAmountServiceImpl 中实现新增的接口方法 - 在 HandlingGroupUserAmountMapper 中添加对应的 SQL 查询
This commit is contained in:
parent
8aef773086
commit
a4fba15a4a
@ -1,15 +1,21 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.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;
|
||||
@ -21,6 +27,7 @@ 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.stream.Collectors;
|
||||
@ -37,6 +44,8 @@ public class HandlingGroupAmountSpecificationsController {
|
||||
|
||||
@Resource
|
||||
private HandlingGroupAmountSpecificationsService handlingGroupAmountSpecificationsService;
|
||||
@Resource
|
||||
private HandlingGroupUserAmountService handlingGroupUserAmountService;
|
||||
|
||||
@Resource
|
||||
private FactoryInfoService factoryInfoService;
|
||||
@ -50,11 +59,20 @@ public class HandlingGroupAmountSpecificationsController {
|
||||
|
||||
@GetMapping("/getTotalNum")
|
||||
@Operation(summary = "获取合计数")
|
||||
public CommonResult<HandlingGroupAmountSpecificationsTotalNumVO> getTotalNum(@RequestParam(required = false) Long factoryId) {
|
||||
HandlingGroupAmountSpecificationsTotalNumVO vo = handlingGroupAmountSpecificationsService.getTotalNum(factoryId);
|
||||
public CommonResult<HandlingGroupAmountSpecificationsTotalNumVO> getTotalNum(@Valid HandlingGroupAmountSpecificationsTotalNumDTO dto) {
|
||||
HandlingGroupAmountSpecificationsTotalNumVO vo = handlingGroupAmountSpecificationsService.getTotalNum(dto);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
|
||||
@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) {
|
||||
@ -88,10 +106,21 @@ public class HandlingGroupAmountSpecificationsController {
|
||||
PageResult<HandlingGroupAmountSpecificationsRespVO> result = BeanUtils.toBean(pageResult, HandlingGroupAmountSpecificationsRespVO.class);
|
||||
// 计算合计 - 先根据工厂+搬运组+日期进行分组
|
||||
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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -28,6 +28,9 @@ public class HandlingGroupAmountSpecificationsPageReqVO extends PageParam {
|
||||
@Schema(description = "叉车司机名称", example = "23178")
|
||||
private String staffName;
|
||||
|
||||
@Schema(description = "搬运工名称", example = "23178")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "搬运规格id", example = "23178")
|
||||
private Long handlingSpecificationsId;
|
||||
|
||||
|
@ -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
|
||||
@ -71,4 +74,6 @@ public class HandlingGroupAmountSpecificationsRespVO {
|
||||
@ExcelProperty("数量小计")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "搬运工明细列表")
|
||||
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
@ -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);
|
||||
@ -123,7 +117,6 @@ public class StaffController {
|
||||
|
||||
@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);
|
||||
@ -143,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 {
|
||||
@ -193,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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ 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;
|
||||
@ -56,4 +58,12 @@ public interface HandlingGroupAmountSpecificationsMapper extends BaseMapperX<Han
|
||||
* @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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
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.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;
|
||||
|
||||
/**
|
||||
@ -67,5 +69,13 @@ public interface HandlingGroupAmountSpecificationsService {
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(Long factoryId);
|
||||
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto);
|
||||
|
||||
/**
|
||||
* 获取金额小计
|
||||
* @param totalCount
|
||||
* @param handlingSpecificationsId
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecific
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
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;
|
||||
@ -20,12 +21,10 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/**
|
||||
@ -58,7 +57,7 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
|
||||
@Override
|
||||
public List<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsList(Long factoryId, String dateStr, Long handlingGroupId) {
|
||||
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsList(factoryId,dateStr,handlingGroupId);
|
||||
return handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsList(factoryId, dateStr, handlingGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,15 +138,14 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
continue;
|
||||
}
|
||||
if (handlingSpecificationsDO.getType() == 0) {
|
||||
totalAmount = new BigDecimal(item.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getUnitPrice());
|
||||
} else {
|
||||
totalAmount = new BigDecimal(item.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
totalAmount = new BigDecimal(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount().toString()).multiply(handlingSpecificationsDO.getWeight())
|
||||
.multiply(handlingSpecificationsDO.getUnitPrice().multiply(THOUSANDTH));
|
||||
}
|
||||
item.setAmount(totalAmount);
|
||||
item.setTotalCount(item.getTotalCount());
|
||||
item.setTotalCount(handlingGroupAmountSpecificationsBatchCreateItemVO.getTotalCount());
|
||||
item.setStaffId(vo.getStaffId());
|
||||
item.setHandlingGroupId(vo.getHandlingGroupId());
|
||||
}
|
||||
handlingGroupAmountSpecificationsMapper.updateBatch(list);
|
||||
}
|
||||
@ -161,14 +159,20 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(Long factoryId) {
|
||||
HandlingGroupAmountSpecificationsTotalNumVO vo = new HandlingGroupAmountSpecificationsTotalNumVO();
|
||||
List<HandlingGroupAmountSpecificationsDO> list = handlingGroupAmountSpecificationsMapper.selectList(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
|
||||
.eq(factoryId != null, HandlingGroupAmountSpecificationsDO::getFactoryId, factoryId));
|
||||
BigDecimal amount = getSumValue(list, HandlingGroupAmountSpecificationsDO::getAmount, BigDecimal::add);
|
||||
Integer num = getSumValue(list, HandlingGroupAmountSpecificationsDO::getTotalCount, Integer::sum);
|
||||
vo.setNum(num.longValue());
|
||||
vo.setAmount(amount);
|
||||
return vo;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
|
||||
|
@ -21,6 +21,10 @@
|
||||
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
|
||||
@ -36,10 +40,21 @@
|
||||
<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' ) >= #{vo.createTime[0]}
|
||||
</if>
|
||||
<if test="vo.createTime[1] != null">
|
||||
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) <= #{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">
|
||||
@ -79,4 +94,37 @@
|
||||
</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' ) >= #{dto.createTime[0]}
|
||||
</if>
|
||||
<if test="dto.createTime[1] != null">
|
||||
and STR_TO_DATE( a.date_str, '%Y-%m-%d' ) <= #{dto.createTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -101,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 >= #{vo.createTime[0]}
|
||||
</if>
|
||||
<if test="vo.createTime[1] != null">
|
||||
and a.create_time <= #{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>
|
||||
|
Loading…
Reference in New Issue
Block a user