Compare commits

..

3 Commits

Author SHA1 Message Date
furongxin
c512c25a50 feat(bpm): 导出支付信息 Excel 功能
- 新增导出支付信息的接口和实现
- 使用 EasyExcel 库进行 Excel 文件生成
- 对数据进行处理和格式化,支持公账和私账分别导出
- 优化了页面查询接口,增加对支付状态的处理
2025-06-20 15:59:41 +08:00
furongxin
d899fdf3d3 feat(smartfactory): 添加工厂和公司列表接口并优化参数接收- 在 FactoryInfoController 中添加 getList 方法,用于获取工厂和公司列表
- 在 FactoryInfoService 接口中添加 getList 方法
- 在 FactoryInfoServiceImpl 中实现 getList 方法
- 优化 StaffSalaryApi 中 updateIsGrant 方法的参数接收,允许 ids 参数为可选
- 在 StaffController 中为 exportStaffExcel 方法添加状态参数,以筛选有效员工
2025-06-20 15:57:01 +08:00
furongxin
b7cb164837 feat(smartfactory): 优化员工导出功能
- 为 CameraDeviceMapper 添加按 sort 字段升序排序
- 在 StaffController 中增加工种字典值和工厂信息的获取,并完善员工信息导出内容
- 更新 StaffRespVO,增加 factoryName 和 workTypeName 字段,修改 sex 字段为 sexStr
2025-06-04 16:55:05 +08:00
55 changed files with 682 additions and 727 deletions

View File

@ -140,6 +140,16 @@
<version>2.0.0-jdk8-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
<version>4.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -2,9 +2,11 @@ package cn.iocoder.yudao.module.bpm.controller.admin.financialpayment;
import cn.hutool.core.collection.CollectionUtil;
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.pojo.UploadUserFile;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveReqVO;
@ -17,15 +19,19 @@ import cn.iocoder.yudao.module.bpm.service.financialpaymentitem.FinancialPayment
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
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.ArrayList;
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
@ -102,6 +108,11 @@ public class FinancialPaymentController {
@Operation(summary = "获得财务支付管理分页")
public CommonResult<PageResult<FinancialPaymentRespVO>> getFinancialPaymentPage(@Valid FinancialPaymentPageReqVO pageReqVO) {
PageResult<FinancialPaymentDO> pageResult = financialPaymentService.getFinancialPaymentPage(pageReqVO);
pageResult.getList().forEach(item -> {
if (StringUtils.isNotEmpty(item.getRecipientName())) {
item.setRecipientName(item.getRecipientName().split(",")[0]);
}
});
return success(BeanUtils.toBean(pageResult, FinancialPaymentRespVO.class));
}
@ -111,4 +122,14 @@ public class FinancialPaymentController {
FinancialPaymentDO paymentDO = financialPaymentService.getPaymentTotal(pageReqVO);
return success(BeanUtils.toBean(paymentDO, FinancialPaymentRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出支付信息 Excel")
@OperateLog(type = EXPORT)
public void exportFactoryInfoExcel(@Valid FinancialPaymentPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
financialPaymentService.exportList(response, pageReqVO);
}
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 用户 Excel 导入 VO
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false避免用户导入有问题
public class FinancialExportExcelVO {
@ExcelProperty("姓名")
private String nickName;
@ExcelProperty("报销部门")
private String deptName;
@ExcelProperty("事项")
private String detail;
@ExcelProperty("金额")
private BigDecimal amount;
@ExcelProperty("卡号")
private String bankNo;
@ExcelProperty("公账/私账")
private String type;
@ExcelProperty("备注")
private String note;
}

View File

@ -39,6 +39,4 @@ public class BpmTaskDonePageReqVO extends PageParam {
@Schema(description = "部门编号")
private Long userId;
@Schema(description = "任务状态")
private Integer result ;
}

View File

@ -93,7 +93,7 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getStartUserId, BpmTaskDonePageRespVO::getStartUserId);
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getProcessDefinitionId, BpmTaskDonePageRespVO::getProcessDefinitionId);
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getCcids, BpmTaskDonePageRespVO::getCcUserIds);
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getStatus, BpmTaskDonePageRespVO::getStatus ) ;
queryWrapperX.selectAs(BpmProcessInstanceExtDO::getResult, BpmTaskDonePageRespVO::getStatus ) ;
queryWrapperX.innerJoin(BpmProcessInstanceExtDO.class, on -> on
.eq(BpmTaskExtDO::getProcessInstanceId, BpmProcessInstanceExtDO::getProcessInstanceId)
@ -102,10 +102,7 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> {
queryWrapperX.likeRight(BpmProcessInstanceExtDO::getProcessDefinitionId, "oa_");
queryWrapperX.eq(BpmTaskExtDO::getAssigneeUserId, userId);
queryWrapperX.ne(BpmTaskExtDO::getReason, BpmConstants.AUTO_APPRAVAL);
// queryWrapperX.ne(BpmTaskExtDO::getResult,4); //还未开始审批发起人主动撤销的流程不显示
if (pageVO.getResult() != null) {
queryWrapperX.eq(BpmTaskExtDO::getResult,pageVO.getResult());
}
queryWrapperX.ne(BpmTaskExtDO::getResult,4); //还未开始审批发起人主动撤销的流程不显示
queryWrapperX.betweenIfPresent(BpmTaskExtDO::getCreateTime, pageVO.getCreateTime());
queryWrapperX.orderByDesc(BpmTaskExtDO::getEndTime);

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.bpm.service.financialpayment;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CustomCellStyleHandler implements CellWriteHandler {
private final Map<String, CellStyle> styleCache = new HashMap<>();
@Override
public void afterCellDispose(
WriteSheetHolder writeSheetHolder,
WriteTableHolder writeTableHolder,
List<WriteCellData<?>> cellDataList,
Cell cell,
Head head,
Integer relativeRowIndex,
Boolean isHead) {
Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(), 7120);
// 获取或创建样式
CellStyle cellStyle = getOrCreateCellStyle(workbook, isHead, relativeRowIndex, cellDataList);
cell.setCellStyle(cellStyle);
}
private CellStyle getOrCreateCellStyle(Workbook workbook, Boolean isHead, Integer relativeRowIndex, List<WriteCellData<?>> cellDataList) {
String key = generateStyleKey(isHead, relativeRowIndex);
if (styleCache.containsKey(key)) {
return styleCache.get(key);
}
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
// if (isHead != null && isHead) {
// setHeaderStyle(workbook, cellStyle, relativeRowIndex, cellDataList);
// }
styleCache.put(key, cellStyle);
return cellStyle;
}
private void setHeaderStyle(Workbook workbook, CellStyle cellStyle, Integer relativeRowIndex, List<WriteCellData<?>> cellDataList) {
if (relativeRowIndex == 0 || relativeRowIndex == 1) {
applyStyle(workbook, cellStyle, IndexedColors.TURQUOISE.getIndex(), (short) 20, cellDataList);
} else if (relativeRowIndex == 2 || relativeRowIndex == 3) {
applyStyle(workbook, cellStyle, IndexedColors.LIGHT_YELLOW.getIndex(), (short) 20, cellDataList);
}
}
private void applyStyle(Workbook workbook, CellStyle cellStyle, short backgroundColor, short fontSize, List<WriteCellData<?>> cellDataList) {
cellStyle.setFillForegroundColor(backgroundColor);
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font font = workbook.createFont();
font.setFontHeightInPoints(fontSize);
cellStyle.setFont(font);
cellDataList.get(0).setWriteCellStyle(null);
}
private String generateStyleKey(Boolean isHead, Integer relativeRowIndex) {
return "isHead:" + isHead + ",rowIndex:" + relativeRowIndex;
}
}

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.Financia
import cn.iocoder.yudao.module.bpm.controller.admin.financialpayment.vo.FinancialPaymentSaveVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
@ -102,4 +103,11 @@ public interface FinancialPaymentService {
* @return 统计信息
*/
FinancialPaymentDO getPaymentTotal(FinancialPaymentPageReqVO pageReqVO);
/**
* 导出支付信息
* @param response 响应
* @param pageReqVO 查询条件
*/
void exportList(HttpServletResponse response, FinancialPaymentPageReqVO pageReqVO);
}

View File

@ -25,7 +25,6 @@ import cn.iocoder.yudao.module.bpm.dal.mysql.oa.*;
import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAExpensesService;
import cn.iocoder.yudao.module.system.api.auth.AdminOauthUserOtherInfoApi;
import cn.iocoder.yudao.module.system.api.auth.dto.AdminOauthUserOtherInfoApiDTO;
import cn.iocoder.yudao.module.system.api.auth.vo.AdminOauthUserOtherInfoApiVO;
@ -33,6 +32,8 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
@ -40,10 +41,13 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
@ -286,4 +290,116 @@ public class FinancialPaymentServiceImpl implements FinancialPaymentService {
pageReqVO.setReceiveUserId(getLoginUserId());
return financialPaymentMapper.selectPaymentTotal(pageReqVO);
}
@Override
public void exportList(HttpServletResponse response, FinancialPaymentPageReqVO pageReqVO) {
try {
if (pageReqVO.getStatus() == null) {
pageReqVO.setStatus(2);
}
// 获取支付信息数据
List<FinancialPaymentDO> list = this.getFinancialPaymentPage(pageReqVO).getList();
list.removeIf(item -> item.getCompanyId() == null);
// 根据付款公司进行分组
Map<Long, List<FinancialPaymentDO>> companyIdMap = list.stream().collect(Collectors.groupingBy(FinancialPaymentDO::getCompanyId));
List<List<String>> data = new ArrayList<>();
for (Map.Entry<Long, List<FinancialPaymentDO>> entry : companyIdMap.entrySet()) {
// 设置表头
data.add(Arrays.asList(entry.getValue().get(0).getCompanyName(), entry.getValue().get(0).getCompanyName(), entry.getValue().get(0).getCompanyName(),
entry.getValue().get(0).getCompanyName(), entry.getValue().get(0).getCompanyName(), entry.getValue().get(0).getCompanyName()));
data.add(this.setTitle());
// 提取所有公账 支付信息
List<FinancialPaymentDO> publicAccount = entry.getValue().stream()
.filter(item -> item.getType() != 9)
.collect(Collectors.toList());
// 提取所有私账 支付信息
List<FinancialPaymentDO> privateAccount = entry.getValue().stream()
.filter(item -> item.getType() == 9)
.collect(Collectors.toList());
// 遍历公账信息
for (FinancialPaymentDO financialPaymentDO : publicAccount) {
List<String> row = new ArrayList<>();
// 设置姓名
row.add(financialPaymentDO.getNickname());
// 设置报销部门
row.add(financialPaymentDO.getDeptName());
// 添加事项
row.add(financialPaymentDO.getReason());
// 添加金额
row.add(financialPaymentDO.getActualPayment().toString());
// 添加卡号
row.add(financialPaymentDO.getRecipientName());
// 添加公账/私账
row.add("公账");
// 添加备注
row.add(financialPaymentDO.getNickname() + "报销");
data.add(row);
}
// 添加公账合计数据
BigDecimal publicAccountTotal = publicAccount.stream().map(FinancialPaymentDO::getActualPayment).reduce(BigDecimal.ZERO, BigDecimal::add);
data.add(Arrays.asList("公账总计", "公账总计", "公账总计", publicAccountTotal.toString(), "", "公账"));
// 遍历私账信息
for (FinancialPaymentDO financialPaymentDO : privateAccount) {
List<String> row = new ArrayList<>();
// 设置姓名
row.add(financialPaymentDO.getNickname());
// 设置报销部门
row.add(financialPaymentDO.getDeptName());
// 添加事项
row.add(financialPaymentDO.getReason());
// 添加金额
row.add(financialPaymentDO.getActualPayment().toString());
// 添加卡号
row.add(financialPaymentDO.getRecipientName());
// 添加公账/私账
row.add("私账");
// 添加备注
row.add(financialPaymentDO.getNickname() + "报销");
data.add(row);
}
// 添加私账合计数据
BigDecimal privateAccountTotal = privateAccount.stream().map(FinancialPaymentDO::getActualPayment).reduce(BigDecimal.ZERO, BigDecimal::add);
data.add(Arrays.asList("私账总计", "私账总计", "私账总计", privateAccountTotal.toString(), "", "私账"));
}
EasyExcel.write(response.getOutputStream())
.autoCloseStream(false)
.excelType(ExcelTypeEnum.XLSX)
.sheet("账目明细")
.registerWriteHandler(new CustomCellStyleHandler())
.doWrite(data);
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("账目", StandardCharsets.UTF_8.name()));
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
} catch (IOException e) {
log.error("[exportList][导出失败]", e);
throw new RuntimeException(e);
}
}
private List<String> setTitle() {
List<String> titleRow = new ArrayList<>();
titleRow.add("姓名");
titleRow.add("报销部门");
titleRow.add("事项");
titleRow.add("金额");
titleRow.add("卡号");
titleRow.add("公账/私账");
titleRow.add("备注");
return titleRow;
}
}

View File

@ -252,7 +252,7 @@ public class BpmOACashServiceImpl extends BpmOABaseService implements BpmOACashS
.setAmountPayable(isImprest == 1 ? amount.abs() : cash.getTotalMoney())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bankRespDTO.getNickname())
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() + "," + bankRespDTO.getBankNo() + "," + bankRespDTO.getBankName() : "")
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
);
}

View File

@ -30,7 +30,6 @@ import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.context.annotation.Lazy;
@ -289,7 +288,7 @@ public class BpmOAExpensesServiceImpl extends BpmOABaseService implements BpmOAE
.setProcessInstanceName(processInstance.getName())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() : "")
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() + "," + bankRespDTO.getBankNo() + "," + bankRespDTO.getBankName() : "")
.setCompanyFactoryId(dto.getId())
);
}

View File

@ -143,7 +143,7 @@ public class BpmOAImprestServiceImpl extends BpmOABaseService implements BpmOAIm
.setProcessInstanceName(processInstance.getName())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bankRespDTO.getNickname())
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() + "," + bankRespDTO.getBankNo() + "," + bankRespDTO.getBankName() : "")
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
);
}

View File

@ -174,7 +174,7 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
.setProcessInstanceName(processInstance.getName())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bankRespDTO.getNickname())
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() + "," + bankRespDTO.getBankNo() + "," + bankRespDTO.getBankName() : "")
);
}
}

View File

@ -147,7 +147,7 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
.setProcessInstanceName(processInstance.getName())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bankRespDTO.getNickname())
.setRecipientName(bankRespDTO != null ? bankRespDTO.getNickname() + "," + bankRespDTO.getBankNo() + "," + bankRespDTO.getBankName() : "")
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
);
}

View File

@ -251,7 +251,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
.setProcessInstanceName(processInstance.getName())
.setBeginTime(processInstance.getCreateTime())
.setEndTime(processInstance.getEndTime())
.setRecipientName(bpmOAReimbursementDO.getNickname())
.setRecipientName(bpmOAReimbursementDO.getNickname() + "," + bpmOAReimbursementDO.getBankNo() + "," + bpmOAReimbursementDO.getBankName())
.setCompanyId(deptRespDTO != null ? deptRespDTO.getId() : null)
);
}

View File

@ -14,7 +14,7 @@
a.type as type,
a.cost_section AS costSection,
a.dept_id AS deptId,
d.name AS deptName,
d.short_name AS deptName,
a.total_money AS amount,
a.detail AS detail,
b.user_id AS userId,
@ -30,7 +30,7 @@
FROM bpm_oa_expenses b
JOIN bpm_oa_expenses_item a ON a.expenses_id = b.id
JOIN bpm_process_instance_ext c ON c.process_instance_id = b.process_instance_id
LEFT JOIN system_dept d ON d.factory_id = a.dept_id
LEFT JOIN sf_factory_info d ON d.id = a.dept_id
LEFT JOIN system_users u ON u.id = b.user_id
LEFT JOIN system_bank ub ON ub.id = b.bank_id
WHERE

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao</artifactId>
<version>2.0.0-jdk8-snapshot</version>
</parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm</artifactId>
<version>2.0.0-jdk8-snapshot</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>infra 模块,主要提供两块能力:
1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等
2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等</description>
<modules>
<module>yudao-module-crm-api</module>
<module>yudao-module-crm-biz</module>
</modules>
</project>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm</artifactId>
<version>2.0.0-jdk8-snapshot</version>
</parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm-api</artifactId>
<version>2.0.0-jdk8-snapshot</version>
<name>${project.artifactId}</name>
<description>infra 模块 API暴露给其它模块调用</description>
<dependencies>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm</artifactId>
<version>2.0.0-jdk8-snapshot</version>
</parent>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm-biz</artifactId>
<version>2.0.0-jdk8-snapshot</version>
<name>${project.artifactId}</name>
<description>infra 模块,主要提供两块能力:
1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等
2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等</description>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-crm-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-product-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-banner</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-biz-error-code</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-job</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-mq</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-file</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>2.0.0-jdk8-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -270,7 +270,7 @@ public class DeptServiceImpl implements DeptService {
@Override
@DataPermission(enable = false)
@Cacheable(cacheNames = RedisKeyConstants.DEPT_CHILD_ID_LIST, key = "#id")
@Cacheable(cacheNames = RedisKeyConstants.DEPT_CHILD_ID_LIST, key = "#id", condition = "#id != null")
public List<DeptDO> getChildDept(Long id) {
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()

View File

@ -19,6 +19,6 @@ public interface StaffSalaryApi {
@PutMapping(PREFIX + "/updateIsGrant")
@Operation(summary = "更新是否已发放薪资")
CommonResult<Boolean> updateIsGrant(@RequestParam("ids") Collection<Long> ids,
CommonResult<Boolean> updateIsGrant(@RequestParam(value = "ids", required = false) Collection<Long> ids,
@RequestParam("isGrant") Integer isGrant);
}

View File

@ -41,7 +41,5 @@ public interface ErrorCodeConstants {
ErrorCode CANNOT_FIND_THE_CORRESPONDING_FACTORY_HANDLING_SPECIFICATION = new ErrorCode(1_000_005_001, "找不到对应的工厂搬运规格");
ErrorCode FACTORY_HANDLING_SPECIFICATION_EXISTS = new ErrorCode(1_000_005_002, "工厂搬运规格已存在");
ErrorCode SPECIFICATION_USER_AMOUNT_NOT_EXISTS = new ErrorCode(1_000_005_003, "工厂当前月份存在未分配人员数据!");
ErrorCode ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA = new ErrorCode(1_000_005_004, "新增数据有重复的搬运组!");
ErrorCode NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP = new ErrorCode(1_000_005_005, "新增数据与老数据有重复的搬运组!");
}

View File

@ -96,6 +96,15 @@ public class FactoryInfoController {
return success(respVO);
}
@GetMapping("/list")
@Operation(summary = "获得工厂以及公司列表 | 用于前端下拉框")
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")
public CommonResult<List<FactorySimpleRespVO>> getList() {
List<FactoryInfoDO> factoryInfo = factoryInfoService.getList();
return success(BeanUtils.toBean(factoryInfo, FactorySimpleRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得工厂列表 | 用于前端下拉框")
@PreAuthorize("@ss.hasPermission('smartfactory:factory-info:query')")

View File

@ -7,7 +7,6 @@ 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.HandlingGroupAmountSpecificationsPageReqDTO;
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;
@ -32,6 +31,7 @@ import java.util.Map;
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.getSumValue;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 搬运组工资规格关联")
@ -87,11 +87,11 @@ public class HandlingGroupAmountSpecificationsController {
@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<HandlingGroupAmountSpecificationsDetailsRespVO>> getHandlingGroupAmountSpecifications(@RequestParam Long factoryId,
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, HandlingGroupAmountSpecificationsDetailsRespVO.class));
return success(BeanUtils.toBean(handlingGroupAmountSpecifications, HandlingGroupAmountSpecificationsRespVO.class));
}
@GetMapping("/page")
@ -109,8 +109,8 @@ public class HandlingGroupAmountSpecificationsController {
}
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));
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.getHandlingGroupId());
if (CollUtil.isNotEmpty(items)) {
List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS = BeanUtils.toBean(items, HandlingGroupUserAmountItemVO.class);
@ -120,14 +120,6 @@ public class HandlingGroupAmountSpecificationsController {
return success(result);
}
@GetMapping("/pageV2")
@Operation(summary = "获得搬运组工资规格关联分页")
public CommonResult<PageResult<HandlingGroupAmountSpecificationsRespVO>> getHandlingGroupAmountSpecificationsPageV2(@Valid HandlingGroupAmountSpecificationsPageReqDTO pageReqVO) {
PageResult<HandlingGroupAmountSpecificationsRespVO> pageResult = handlingGroupAmountSpecificationsService.getHandlingGroupAmountSpecificationsPageV2(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运组工资规格关联 Excel")
@OperateLog(type = EXPORT)

View File

@ -1,43 +0,0 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class HandlingGroupAmountSpecificationsPageReqDTO 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;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "工厂ids", example = "23178")
private List<Long> factoryIds;
}

View File

@ -1,77 +0,0 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
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;
import java.util.List;
@Data
@ExcelIgnoreUnannotated
public class HandlingGroupAmountSpecificationsDetailsRespVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9721")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "工厂id", example = "23178")
private Long factoryId;
@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;
@Schema(description = "搬运规格名称", example = "23178")
@ExcelProperty("搬运规格名称")
private String handlingSpecificationsName;
@Schema(description = "数量", example = "15611")
@ExcelProperty("数量")
private Integer totalCount;
@Schema(description = "日期 格式 yyyy-MM-dd")
@ExcelProperty("日期 格式 yyyy-MM-dd")
private String dateStr;
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
private BigDecimal amount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "金额小计")
@ExcelProperty("金额小计")
private BigDecimal totalAmount;
@Schema(description = "数量小计")
@ExcelProperty("数量小计")
private Integer totalNum;
@Schema(description = "搬运工明细列表")
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
}

View File

@ -1,6 +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;
@ -41,14 +42,26 @@ public class HandlingGroupAmountSpecificationsRespVO {
@ExcelProperty("叉车司机id")
private Long staffId;
@Schema(description = "搬运规格id", example = "23178")
@ExcelProperty("搬运规格id")
private Long handlingSpecificationsId;
@Schema(description = "搬运规格名称", example = "23178")
@ExcelProperty("搬运规格名称")
private List<SpecificationDetailVO> specificationDetails;
private String handlingSpecificationsName;
@Schema(description = "数量", example = "15611")
@ExcelProperty("数量")
private Integer totalCount;
@Schema(description = "日期 格式 yyyy-MM-dd")
@ExcelProperty("日期 格式 yyyy-MM-dd")
private String dateStr;
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
private BigDecimal amount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ -60,10 +73,6 @@ public class HandlingGroupAmountSpecificationsRespVO {
@Schema(description = "数量小计")
@ExcelProperty("数量小计")
private Integer totalNum;
/**
* 搬运规格id 逗号隔开
*/
private String handlingSpecificationsIds;
@Schema(description = "搬运工明细列表")
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;

View File

@ -1,84 +0,0 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo.HandlingGroupUserAmountItemVO;
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;
import java.util.List;
@Data
@ExcelIgnoreUnannotated
public class HandlingGroupAmountSpecificationsRespVOV2 {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9721")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "工厂id", example = "23178")
private Long factoryId;
@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 = "日期 格式 yyyy-MM-dd")
@ExcelProperty("日期 格式 yyyy-MM-dd")
private String dateStr;
@Schema(description = "搬运规格id", example = "23178")
@ExcelProperty("搬运规格id")
private Long handlingSpecificationsId;
@Schema(description = "搬运规格名称", example = "23178")
@ExcelProperty("搬运规格名称")
private String handlingSpecificationsName;
@Schema(description = "数量", example = "15611")
@ExcelProperty("数量")
private Integer totalCount;
@Schema(description = "总金额(根据规格和总量计算出 该搬运组获得的总金额)")
@ExcelProperty("总金额(根据规格和总量计算出 该搬运组获得的总金额)")
private BigDecimal amount;
@Schema(description = "金额小计")
@ExcelProperty("金额小计")
private BigDecimal totalAmount;
@Schema(description = "数量小计")
@ExcelProperty("数量小计")
private Integer totalNum;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "搬运工明细列表")
private List<HandlingGroupUserAmountItemVO> handlingGroupUserAmountItemVOS;
}

View File

@ -1,86 +0,0 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
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.*;
import java.math.BigDecimal;
import java.util.List;
/**
* 搬运组工资规格关联 DO
*
* @author 艾楷
*/
@Data
public class HandlingGroupAmountSpecificationsVO extends BaseDO {
/**
* 主键id
*/
@TableId
private Long id;
/**
* 工厂id
*/
private Long factoryId;
/**
* 搬运规格id
*/
private Long handlingSpecificationsId;
/**
* 搬运组id
*/
private Long handlingGroupId;
/**
* 叉车司机id
*/
private Long staffId;
/**
* 数量
*/
private Integer totalCount;
/**
* 日期 格式 yyyy-MM-dd
*/
private String dateStr;
/**
* 总金额根据规格和总量计算出 该搬运组获得的总金额
*/
private BigDecimal amount;
/**
* 金额合计
*/
@TableField(exist = false)
private BigDecimal totalAmount;
/**
* 数量合计
*/
@TableField(exist = false)
private Integer totalNum;
/**
* 工厂名称
*/
@TableField(exist = false)
private String factoryName;
/**
* 搬运组名称
*/
@TableField(exist = false)
private String handlingGroupName;
/**
* 叉车司机名称
*/
@TableField(exist = false)
private String staffName;
/**
* 搬运规格id 逗号隔开
*/
@TableField(exist = false)
private List<SpecificationDetailVO> specificationDetails;
}

View File

@ -1,31 +0,0 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class SpecificationDetailVO {
@Schema(description = "工厂搬运规格id", example = "23178")
private Long handlingSpecificationsId;
@Schema(description = "规格名称", example = "标准规格")
private String handlingSpecificationsName;
@Schema(description = "数量", example = "23178")
private Integer totalCount;
@Schema(description = "金额", example = "23178")
private BigDecimal amount;
public SpecificationDetailVO() {
}
public SpecificationDetailVO(Long handlingSpecificationsId, String handlingSpecificationsName, Integer totalCount, BigDecimal amount) {
this.handlingSpecificationsId = handlingSpecificationsId;
this.handlingSpecificationsName = handlingSpecificationsName;
this.totalCount = totalCount;
this.amount = amount;
}
}

View File

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

View File

@ -1,13 +1,11 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
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;
@ -21,8 +19,8 @@ public class HandlingGroupUserAmountPageReqVO extends PageParam {
@Schema(description = "用户id", example = "12639")
private Long userId;
@Schema(description = "工厂id", example = "27617")
private Long factoryId;
@Schema(description = "搬运组工资规格关联id", example = "27617")
private Long handlingGroupAmountSpecificationsId;
@Schema(description = "搬运组id", example = "27617")
private Long handlingGroupId;

View File

@ -25,6 +25,10 @@ public class HandlingGroupUserAmountRespVO {
@ExcelProperty("用户名称")
private String userName;
@Schema(description = "搬运组工资规格关联id", example = "27617")
@ExcelProperty("搬运组工资规格关联id")
private Long handlingGroupAmountSpecificationsId;
@Schema(description = "日期 格式 yyyy-MM-dd")
@ExcelProperty("日期 格式 yyyy-MM-dd")
private String dateStr;

View File

@ -1,8 +1,10 @@
package cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupuseramount.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 搬运组每日个人工资记录新增/修改 Request VO")
@ -18,8 +20,8 @@ public class HandlingGroupUserAmountSaveReqVO {
@Schema(description = "工厂id", example = "12639")
private Long factoryId;
@Schema(description = "搬运组id", example = "12639")
private Long handlingGroupId;
@Schema(description = "搬运组工资规格关联id", example = "27617")
private Long handlingGroupAmountSpecificationsId;
@Schema(description = "日期 格式 yyyy-MM-dd")
private String dateStr;

View File

@ -18,7 +18,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
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 org.springframework.web.multipart.MultipartFile;
@ -140,10 +139,29 @@ public class StaffController {
public void exportStaffExcel(@Valid StaffPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
pageReqVO.setStatus(1);
List<StaffDO> list = staffService.getStaffPage(pageReqVO).getList();
// 获取工种字典值
List<DictDataRespDTO> dictDataRespDTOS = dictDataApi.getDictDataList("user_work_type").getCheckedData();
Map<String, String> workTypeMap = dictDataRespDTOS.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
// 获取工厂信息Map
Map<Long, FactoryInfoDO> factoryInfoDOMap = convertMap(factoryInfoService.getFactoryList(), FactoryInfoDO::getId);
List<StaffRespVO> respVOS = BeanUtils.toBean(list, StaffRespVO.class);
respVOS.forEach(item -> {
if (item.getWorkTypeId() != null) {
item.setWorkTypeName(workTypeMap.getOrDefault(item.getWorkTypeId().toString(), ""));
}
// 设置性别
item.setSexStr(item.getSex() == null ? null : item.getSex() == 1 ? "" : "");
// 设置工厂名称
item.setFactoryName(factoryInfoDOMap.get(item.getFactoryId()) != null ? factoryInfoDOMap.get(item.getFactoryId()).getShortName() : null);
});
// 导出 Excel
ExcelUtils.write(response, "员工.xls", "数据", StaffRespVO.class,
BeanUtils.toBean(list, StaffRespVO.class));
ExcelUtils.write(response, "员工.xls", "数据", StaffRespVO.class, respVOS);
}
@GetMapping("/get-import-template")

View File

@ -20,27 +20,34 @@ public class StaffRespVO {
@ExcelProperty("姓名")
private String nickName;
@Schema(description = "工厂名称", example = "6971")
@ExcelProperty("工厂名称")
private String factoryName;
@Schema(description = "年龄")
@ExcelProperty("年龄")
private Integer age;
@Schema(description = "用户性别0男 1女 2未知")
@ExcelProperty("性别")
@Schema(description = "用户性别1男 2女")
private Integer sex;
@Schema(description = "用户性别1男 2女")
@ExcelProperty("性别")
private String sexStr;
@Schema(description = "工种id", example = "6971")
private Integer workTypeId;
@Schema(description = "工种名称", example = "6971")
@ExcelProperty("工种")
private String workTypeName;
@Schema(description = "所属业务类型")
private Integer businessType;
@Schema(description = "工厂id", example = "6971")
private Long factoryId;
@Schema(description = "工厂名称", example = "6971")
@ExcelProperty("工厂名称")
private String factoryName;
@Schema(description = "手机号")
@ExcelProperty("手机号")
private String mobile;

View File

@ -39,9 +39,4 @@ public class HandlingGroupDO extends BaseDO {
@TableField(exist = false)
private String factoryName;
/**
* 搬运日期
*/
@TableField(exist = false)
private String dateStr;
}

View File

@ -1,15 +1,15 @@
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.SpecificationDetailVO;
import com.alibaba.excel.annotation.ExcelProperty;
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;
import java.util.List;
/**
* 搬运组工资规格关联 DO
@ -17,8 +17,7 @@ import java.util.List;
* @author 艾楷
*/
@TableName("sf_handling_group_amount_specifications")
@KeySequence("sf_handling_group_amount_specifications_seq")
// 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@KeySequence("sf_handling_group_amount_specifications_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ -40,11 +39,6 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
* 搬运规格id
*/
private Long handlingSpecificationsId;
/**
* 搬运规格名称
*/
@TableField(exist = false)
private String handlingSpecificationsName;
/**
* 搬运组id
*/
@ -67,16 +61,8 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
* 总金额根据规格和总量计算出 该搬运组获得的总金额
*/
private BigDecimal amount;
/**
* 金额合计
*/
@TableField(exist = false)
private BigDecimal totalAmount;
/**
* 数量合计
*/
@TableField(exist = false)
private Integer totalNum;
/**
* 工厂名称
*/
@ -93,8 +79,8 @@ public class HandlingGroupAmountSpecificationsDO extends BaseDO {
@TableField(exist = false)
private String staffName;
/**
* 搬运规格id 逗号隔开
* 搬运规格名称
*/
@TableField(exist = false)
private List<SpecificationDetailVO> specificationDetails;
private String handlingSpecificationsName;
}

View File

@ -40,6 +40,11 @@ public class HandlingGroupUserAmountDO extends BaseDO {
@TableField(exist = false)
private String userName;
/**
* 搬运组工资规格关联id
*/
private Long handlingGroupAmountSpecificationsId;
/**
* 搬运组id
*/

View File

@ -39,6 +39,7 @@ public interface CameraDeviceMapper extends BaseMapperX<CameraDeviceDO> {
return selectList(new LambdaQueryWrapperX<CameraDeviceDO>()
.eq(factoryId != null, CameraDeviceDO::getFactoryId, factoryId)
.eq(CameraDeviceDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.eq(CameraDeviceDO::getIsShow, 1));
.eq(CameraDeviceDO::getIsShow, 1)
.orderByAsc(CameraDeviceDO::getSort));
}
}

View File

@ -1,22 +1,16 @@
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.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupPageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsVO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
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;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import java.util.List;
/**
* 搬运组 Mapper
@ -36,25 +30,10 @@ public interface HandlingGroupMapper extends BaseMapperX<HandlingGroupDO> {
}
/**
*
* @param page
* @param vo
* @return
*/
IPage<HandlingGroupDO> selectPageList(@Param("page") Page<Object> page, @Param("vo") HandlingGroupPageReqVO vo);
/**
* 根据时间分组查询分页
*
* @param page
* @param vo
* @return
*/
IPage<HandlingGroupAmountSpecificationsVO> selectPageListByDateStr(@Param("page") Page<Object> page, @Param("vo") HandlingGroupAmountSpecificationsPageReqDTO vo);
/**
*
* @param id
* @return
*/
HandlingGroupDO getHandlingGroup(@Param("id") Long id);
}

View File

@ -26,6 +26,7 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
default PageResult<HandlingGroupUserAmountDO> selectPage(HandlingGroupUserAmountPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HandlingGroupUserAmountDO>()
.eqIfPresent(HandlingGroupUserAmountDO::getUserId, reqVO.getUserId())
.eqIfPresent(HandlingGroupUserAmountDO::getHandlingGroupAmountSpecificationsId, reqVO.getHandlingGroupAmountSpecificationsId())
.eqIfPresent(HandlingGroupUserAmountDO::getDateStr, reqVO.getDateStr())
.eqIfPresent(HandlingGroupUserAmountDO::getAmount, reqVO.getAmount())
.betweenIfPresent(HandlingGroupUserAmountDO::getCreateTime, reqVO.getCreateTime())
@ -50,7 +51,6 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
/**
* 获取月工资列表
*
* @param factoryId
* @param dateList
* @param name
@ -60,25 +60,21 @@ public interface HandlingGroupUserAmountMapper extends BaseMapperX<HandlingGroup
/**
* 列表
*
* @param vo
* @return
*/
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(@Param("vo") HandlingGroupUserAmountPageReqVO vo);
/**
*
* @param handlingGroupAmountSpecificationsIds
* @return
*/
List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(@Param("handlingGroupAmountSpecificationsIds") List<Long> handlingGroupAmountSpecificationsIds);
List<HandlingGroupUserAmountDO> getByHandlingGroupIds(@Param("handlingGroupIds") List<Long> handlingGroupIds);
List<HandlingGroupUserAmountDO> selectAmountSum(@Param("factoryId") Long factoryId, @Param("month") String month);
Long selectIsExists(@Param("factoryId") Long factoryId, @Param("month") String month);
/**
* 通过工厂列表ids 和日期列表 搬运组ids 获取
*
* @param factoryIds
* @param dateStrList
* @param handlingGroupIds
* @return
*/
List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(@Param("factoryIds") List<Long> factoryIds, @Param("dateStrList") List<String> dateStrList, @Param("handlingGroupIds") List<Long> handlingGroupIds);
}

View File

@ -44,11 +44,4 @@ public interface HandlingSpecificationsMapper extends BaseMapperX<HandlingSpecif
* @return
*/
List<HandlingSpecificationsDO> getHandlingSpecificationsList(@Param("vo") HandlingSpecificationsPageReqVO vo);
/**
*
* @param id
* @return
*/
HandlingSpecificationsDO getHandlingSpecifications(@Param("id") Long id);
}

View File

@ -158,4 +158,10 @@ public interface FactoryInfoService {
* @return 工厂列表
*/
List<FactoryInfoDO> getFactoryListByLoginUser();
/**
* 获得工厂以及公司列表
* @return 工厂列表
*/
List<FactoryInfoDO> getList();
}

View File

@ -422,4 +422,12 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
return factoryInfoMapper.selectListByType(factoryIds);
}
@Override
public List<FactoryInfoDO> getList() {
return factoryInfoMapper.selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
.eq(FactoryInfoDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.orderByAsc(FactoryInfoDO::getType));
}
}

View File

@ -51,7 +51,7 @@ public class HandlingGroupServiceImpl extends ServiceImpl<HandlingGroupMapper, H
@Override
public HandlingGroupDO getHandlingGroup(Long id) {
return handlingGroupMapper.getHandlingGroup(id);
return handlingGroupMapper.selectById(id);
}
@Override

View File

@ -1,12 +1,9 @@
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.HandlingGroupAmountSpecificationsPageReqDTO;
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.handlinggroup.HandlingGroupDO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsDO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.math.BigDecimal;
@ -17,7 +14,7 @@ import java.util.List;
*
* @author 艾楷
*/
public interface HandlingGroupAmountSpecificationsService extends IService<HandlingGroupAmountSpecificationsDO> {
public interface HandlingGroupAmountSpecificationsService {
/**
* 获得搬运组工资规格关联
@ -69,22 +66,16 @@ public interface HandlingGroupAmountSpecificationsService extends IService<Handl
/**
* 获取合计
*
* @param factoryId
* @return
*/
HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto);
/**
* 获取金额小计
*
* @param totalCount
* @param handlingSpecificationsId
* @return
*/
BigDecimal getAmountSubtotal(Integer totalCount, Long handlingSpecificationsId);
/**
* @param pageReqVO
* @return
*/
PageResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecificationsPageV2(@Valid HandlingGroupAmountSpecificationsPageReqDTO pageReqVO);
}

View File

@ -2,42 +2,32 @@ package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecific
import cn.hutool.core.collection.CollUtil;
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.HandlingGroupListVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.dto.HandlingGroupAmountSpecificationsPageReqDTO;
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.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroup.HandlingGroupMapper;
import cn.iocoder.yudao.module.smartfactory.dal.mysql.handlinggroupamountspecifications.HandlingGroupAmountSpecificationsMapper;
import cn.iocoder.yudao.module.smartfactory.service.handlinggroupuseramount.HandlingGroupUserAmountService;
import cn.iocoder.yudao.module.smartfactory.service.handlingspecifications.HandlingSpecificationsService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import com.alibaba.druid.sql.visitor.functions.Lpad;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
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.ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA;
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP;
/**
* 搬运组工资规格关联 Service 实现类
@ -46,13 +36,11 @@ import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.NEW_
*/
@Service
@Validated
public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<HandlingGroupAmountSpecificationsMapper, HandlingGroupAmountSpecificationsDO> implements HandlingGroupAmountSpecificationsService {
public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGroupAmountSpecificationsService {
@Resource
private HandlingGroupAmountSpecificationsMapper handlingGroupAmountSpecificationsMapper;
@Resource
private HandlingGroupMapper handlingGroupMapper;
@Resource
private HandlingSpecificationsService handlingSpecificationsService;
@Resource
private HandlingGroupUserAmountService handlingGroupUserAmountService;
@ -91,26 +79,6 @@ public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<Ha
@Override
public void batchCreate(HandlingGroupAmountSpecificationsBatchCreateVO vo) {
List<Long> newHandlingGroupIds = vo.getHandlingGroupList().stream().map(HandlingGroupListVO::getHandlingGroupId).collect(Collectors.toList());
// -- 先判断 新增之中有没有冲突的搬运组
int num = newHandlingGroupIds.size();
List<Long> distinctList = newHandlingGroupIds.stream().distinct().collect(Collectors.toList());
if (num > distinctList.size()) {
throw exception(ADDED_A_HANDLING_GROUP_WITH_DUPLICATE_DATA);
}
// -- 再判断是否有重复的数据 - 同一天 同一个工厂 不可以出现两个相同的搬运组
List<HandlingGroupAmountSpecificationsDO> oldList = this.list(new LambdaQueryWrapper<HandlingGroupAmountSpecificationsDO>()
.eq(HandlingGroupAmountSpecificationsDO::getFactoryId, vo.getFactoryId())
.eq(HandlingGroupAmountSpecificationsDO::getDateStr, vo.getDateStr()));
List<Long> oldHandlingGroupIds = new ArrayList<>();
if (CollUtil.isNotEmpty(oldList)) {
oldHandlingGroupIds = oldList.stream().map(HandlingGroupAmountSpecificationsDO::getHandlingGroupId).collect(Collectors.toList());
}
if (CollUtil.isNotEmpty(CollUtil.intersection(distinctList, oldHandlingGroupIds))) {
throw exception(NEW_DATA_AND_OLD_DATA_HAVE_DUPLICATE_HANDLING_GROUP);
}
List<HandlingGroupAmountSpecificationsDO> list = new ArrayList<>();
// -- 获取到所有的规格列表
List<Long> handlingSpecificationsIds = vo.getHandlingGroupList().stream()
@ -195,11 +163,9 @@ public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<Ha
handlingGroupAmountSpecificationsMapper.deleteBatchIds(ids);
handlingGroupUserAmountService.remove(new LambdaQueryWrapper<HandlingGroupUserAmountDO>()
.eq(HandlingGroupUserAmountDO::getFactoryId, vo.getFactoryId())
.eq(HandlingGroupUserAmountDO::getHandlingGroupId, vo.getHandlingGroupId())
.eq(HandlingGroupUserAmountDO::getDateStr, vo.getDateStr()));
.in(HandlingGroupUserAmountDO::getHandlingGroupAmountSpecificationsId, ids)
);
}
@Override
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto) {
// 判断当前登录人是否属于工厂主管
@ -223,27 +189,4 @@ public class HandlingGroupAmountSpecificationsServiceImpl extends ServiceImpl<Ha
}
return totalAmount;
}
@Override
public PageResult<HandlingGroupAmountSpecificationsRespVO> getHandlingGroupAmountSpecificationsPageV2(HandlingGroupAmountSpecificationsPageReqDTO pageReqVO) {
IPage<HandlingGroupAmountSpecificationsVO> handlingGroupPage = handlingGroupMapper.selectPageListByDateStr(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
// 搬运规格ids - 拼接 一起查询
PageResult<HandlingGroupAmountSpecificationsVO> resultPage = new PageResult<>(handlingGroupPage.getRecords(), handlingGroupPage.getTotal());
PageResult<HandlingGroupAmountSpecificationsRespVO> result = BeanUtils.toBean(resultPage, HandlingGroupAmountSpecificationsRespVO.class);
List<Long> factoryIds = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getFactoryId).distinct().collect(Collectors.toList());
List<String> dateStrList = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getDateStr).distinct().collect(Collectors.toList());
List<Long> handlingGroupIds = result.getList().stream().map(HandlingGroupAmountSpecificationsRespVO::getHandlingGroupId).distinct().collect(Collectors.toList());
if (CollUtil.isNotEmpty(factoryIds) && CollUtil.isNotEmpty(dateStrList) && CollUtil.isNotEmpty(handlingGroupIds)) {
// -- 工厂 - 时间 -
List<HandlingGroupUserAmountDO> handlingGroupUserAmountDOS = handlingGroupUserAmountService.getByFactorIdAndDateStrAndHandlingGroupId(factoryIds, dateStrList, handlingGroupIds);
Map<String, List<HandlingGroupUserAmountDO>> map = handlingGroupUserAmountDOS.stream().collect(Collectors.groupingBy(
a -> a.getFactoryId() + "-" + a.getDateStr() + "-" + a.getHandlingGroupId()
));
for (HandlingGroupAmountSpecificationsRespVO handlingGroupAmountSpecificationsRespVO : result.getList()) {
String key = handlingGroupAmountSpecificationsRespVO.getFactoryId() + "-" + handlingGroupAmountSpecificationsRespVO.getDateStr() + "-" + handlingGroupAmountSpecificationsRespVO.getHandlingGroupId();
handlingGroupAmountSpecificationsRespVO.setHandlingGroupUserAmountItemVOS(BeanUtils.toBean(map.get(key), HandlingGroupUserAmountItemVO.class));
}
}
return result;
}
}

View File

@ -84,29 +84,24 @@ public interface HandlingGroupUserAmountService extends IService<HandlingGroupUs
/**
* 列表
*
* @param pageReqVO
* @return
*/
List<HandlingGroupUserAmountDO> getHandlingGroupUserAmountList(HandlingGroupUserAmountPageReqVO pageReqVO);
/**
* 确认搬运工组薪资确认后添加至员工薪资表
*
* @param handlingGroupAmountSpecificationsIds
* @return
*/
List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(List<Long> handlingGroupAmountSpecificationsIds);
/**
* 确认搬运工组薪资确认后添加至员工薪资表
* @param factoryId
* @param month
*/
void confirmHandlingGroupUserAmount(Long factoryId, String month);
List<HandlingGroupUserAmountDO> getByHandlingGroupIds(List<Long> handlingGroupIds);
/**
* 通过工厂列表ids 和日期列表 搬运组ids 获取
*
* @param factoryIds
* @param dateStrList
* @param handlingGroupIds
* @return
*/
List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(List<Long> factoryIds, List<String> dateStrList, List<Long> handlingGroupIds);
}

View File

@ -108,7 +108,9 @@ public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGrou
@Override
@Transactional(rollbackFor = Exception.class)
public void createOrEdit(HandlingGroupUserAmountSaveReqVO createReqVO) {
HandlingGroupAmountSpecificationsDO handlingGroupAmountSpecificationsDO = handlingGroupAmountSpecificationsMapper.selectById(createReqVO.getHandlingGroupAmountSpecificationsId());
// 插入
createReqVO.setFactoryId(handlingGroupAmountSpecificationsDO.getFactoryId());
HandlingGroupUserAmountDO handlingGroupUserAmount = BeanUtils.toBean(createReqVO, HandlingGroupUserAmountDO.class);
handlingGroupUserAmountMapper.insertOrUpdate(handlingGroupUserAmount);
}
@ -169,6 +171,11 @@ public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGrou
return handlingGroupUserAmountMapper.getHandlingGroupUserAmountList(pageReqVO);
}
@Override
public List<HandlingGroupUserAmountDO> getByHandlingGroupAmountSpecificationsId(List<Long> handlingGroupAmountSpecificationsIds) {
return handlingGroupUserAmountMapper.getByHandlingGroupAmountSpecificationsId(handlingGroupAmountSpecificationsIds);
}
@Override
public void confirmHandlingGroupUserAmount(Long factoryId, String month) {
@ -247,9 +254,4 @@ public class HandlingGroupUserAmountServiceImpl extends ServiceImpl<HandlingGrou
return handlingGroupUserAmountMapper.getByHandlingGroupIds(handlingGroupIds);
}
@Override
public List<HandlingGroupUserAmountDO> getByFactorIdAndDateStrAndHandlingGroupId(List<Long> factoryIds, List<String> dateStrList, List<Long> handlingGroupIds) {
return handlingGroupUserAmountMapper.getByFactorIdAndDateStrAndHandlingGroupId(factoryIds, dateStrList, handlingGroupIds);
}
}

View File

@ -64,7 +64,7 @@ public class HandlingSpecificationsServiceImpl extends ServiceImpl<HandlingSpeci
@Override
public HandlingSpecificationsDO getHandlingSpecifications(Long id) {
return handlingSpecificationsMapper.getHandlingSpecifications(id);
return handlingSpecificationsMapper.selectById(id);
}
@Override

View File

@ -50,7 +50,6 @@ public class HikServiceImpl implements HikService {
String result = ArtemisHttpUtil
.doPostStringArtemis(path, JSONUtil.toJsonStr(body), null, null, "application/json");
log.info("{}监控查看预览地址返回:{}", JSONUtil.toJsonStr(body), result);
//监控查看预览地址返回{"code":"0","msg":"success","data":{"url":"ws://172.16.52.253:559/openUrl/ZZYpOFO"}}
if (StringUtils.isEmpty(result)) {
// throw new ServiceException("监控查看预览地址返回为空");
System.out.println("监控查看预览地址返回为空");
@ -127,7 +126,7 @@ public class HikServiceImpl implements HikService {
@Override
public String operateCamera(CameraOperateDTO dto) {
final String operateUrlApi = ArtemisApiConstant.operateUrlApi;//artemis/api/video/v1/ptzs/controlling
final String operateUrlApi = ArtemisApiConstant.operateUrlApi;
Map<String, String> path = new HashMap<String, String>(1) {
{
put("https://", operateUrlApi);

View File

@ -17,8 +17,6 @@
from sf_handling_group a
left join sf_factory_info as b on a.factory_id = b.id
<where>
a.deleted = 0
and b.deleted = 0
<if test="vo.factoryId != null">
and a.factory_id = #{vo.factoryId}
</if>
@ -27,119 +25,4 @@
</if>
</where>
</select>
<resultMap id="handlingSummaryMap"
type="cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroupamountspecifications.vo.HandlingGroupAmountSpecificationsVO">
<!-- 基础字段映射 -->
<id property="id" column="id"/>
<result property="factoryId" column="factory_id"/>
<result property="handlingGroupId" column="handling_group_id"/>
<result property="handlingSpecificationsId" column="handling_specifications_id"/>
<result property="staffId" column="staff_id"/>
<result property="totalCount" column="total_count"/>
<result property="dateStr" column="date_str"/>
<result property="amount" column="amount"/>
<result property="creator" column="creator"/>
<result property="createTime" column="create_time"/>
<result property="updater" column="updater"/>
<result property="updateTime" column="update_time"/>
<result property="deleted" column="deleted"/>
<!-- 关联字段 -->
<result property="factoryName" column="factoryName"/>
<result property="handlingGroupName" column="handlingGroupName"/>
<result property="staffName" column="staffName"/>
<!-- 聚合字段 -->
<result property="totalAmount" column="totalAmount"/>
<result property="totalNum" column="totalNum"/>
<!-- 自定义对象列表 (JSON 映射) -->
<result property="specificationDetails" column="specificationDetails"
typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
javaType="java.util.List"
/>
</resultMap>
<select id="selectPageListByDateStr"
resultMap="handlingSummaryMap">
SELECT
a.*,
b.short_name as factoryName,
d.handling_group_name as handlingGroupName,
c.nick_name as staffName,
SUM( a.amount ) AS totalAmount,
sum( a.total_count ) AS totalNum,
JSON_ARRAYAGG(
JSON_OBJECT(
'handlingSpecificationsId', a.handling_specifications_id,
'totalCount', a.total_count,
'amount', a.amount,
'handlingSpecificationsName', (
SELECT hs.specifications_name
FROM sf_handling_specifications as hs
WHERE hs.id = a.handling_specifications_id
)
)
) AS specificationDetails
FROM
sf_handling_group_amount_specifications AS a
left join sf_factory_info as b on a.factory_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="vo.factoryId != null">
and a.factory_id = #{vo.factoryId}
</if>
<if test="vo.factoryIds != null and vo.factoryIds.size() > 0">
and a.factory_id in
<foreach collection="vo.factoryIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<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.createTime != null and vo.createTime.length > 0">
<if test="vo.createTime[0] != null">
and STR_TO_DATE( c.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>
<if test="vo.staffName != null and vo.staffName != ''">
and c.nick_name like concat('%', #{vo.staffName}, '%')
</if>
<if test="vo.porterName != null and vo.porterName != ''">
AND EXISTS (
select e.id from sf_handling_group_user_amount as e
left join sf_staff as g on g.id = e.user_id
where a.factory_id = e.factory_id
and a.date_str = e.date_str
and a.handling_group_id = e.handling_group_id
and g.nick_name like concat('%', #{vo.porterName}, '%')
and e.deleted = 0
)
</if>
</where>
GROUP BY
a.factory_id,
a.date_str,
a.handling_group_id
</select>
<select id="getHandlingGroup"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroup.HandlingGroupDO">
SELECT a.*,
b.short_name as factoryName
FROM sf_handling_group AS a
left join sf_factory_info as b on a.factory_id = b.id
WHERE a.deleted = 0
and a.id = #{id}
</select>
</mapper>

View File

@ -24,7 +24,6 @@
<where>
a.deleted = 0
and b.deleted = 0
and d.deleted = 0
<if test="vo.handlingSpecificationsId != null">
AND a.handling_specifications_id = #{vo.handlingSpecificationsId}
</if>
@ -47,9 +46,7 @@
AND EXISTS (
select e.id from sf_handling_group_user_amount as e
left join sf_staff as g on g.id = e.user_id
where a.factory_id = e.factory_id
and a.date_str = e.date_str
and a.handling_group_id = e.handling_group_id
where a.id = e.handling_group_amount_specifications_id
and g.nick_name like concat('%', #{vo.porterName}, '%')
and e.deleted = 0
)
@ -135,9 +132,7 @@
LEFT JOIN sf_staff AS d ON d.id = c.user_id
WHERE
c.deleted = 0
and a.factory_id = c.factory_id
and a.date_str = c.date_str
and a.handling_group_id = c.handling_group_id
and a.id = c.handling_group_amount_specifications_id
and d.nick_name like concat('%', #{dto.porterName}, '%')
)
</if>

View File

@ -24,6 +24,9 @@
<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>
@ -54,6 +57,9 @@
<if test="dto.factoryId != null">
AND a.factory_id = #{dto.factoryId}
</if>
<if test="dto.handlingGroupAmountSpecificationsId != null">
AND b.handling_group_amount_specifications_id = #{dto.handlingGroupAmountSpecificationsId}
</if>
<if test="dto.dateStr != null and dto.dateStr != ''">
and b.date_str like concat('%', #{dto.dateStr}, '%')
</if>
@ -107,14 +113,14 @@
<if test="vo.userId != null">
AND a.user_id = #{vo.userId}
</if>
<if test="vo.factoryId != null">
and a.factory_id = #{vo.factoryId}
</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.date_str like concat('%', #{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">
@ -126,6 +132,23 @@
</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>
<select id="selectAmountSum" resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlinggroupuseramount.HandlingGroupUserAmountDO">
SELECT
@ -175,33 +198,4 @@
</if>
</where>
</select>
<select id="getByFactorIdAndDateStrAndHandlingGroupId"
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="factoryIds != null and factoryIds.size() > 0 ">
and a.factory_id in
<foreach collection="factoryIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="dateStrList != null and dateStrList.size() > 0 ">
and a.date_str in
<foreach collection="dateStrList" item="dateStr" open="(" separator="," close=")">
#{dateStr}
</foreach>
</if>
<if test="handlingGroupIds != null and handlingGroupIds.size() > 0 ">
and a.handling_group_id in
<foreach collection="handlingGroupIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -51,18 +51,4 @@
</if>
</where>
</select>
<select id="getHandlingSpecifications"
resultType="cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO">
select a.*,
b.short_name as factoryName
from sf_handling_specifications as a
left join sf_factory_info as b on a.factory_id = b.id
<where>
a.deleted = 0
and b.deleted = 0
<if test="id != null">
and a.id = #{id}
</if>
</where>
</select>
</mapper>