maven
5 天以前 539624ef39177ebb6fd5577b83df7097dd6f4bec
Merge remote-tracking branch 'origin/dev_New' into dev_New
已添加45个文件
已修改34个文件
3194 ■■■■■ 文件已修改
doc/20260306_create_purchase_return_orders.sql 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/ScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/dto/CustomerFollowUpFileDto.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/common/enums/ProcessType.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/common/vo/SimpleFileVo.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/controller/ReturnSaleProductController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/dto/ReturnSaleProductDto.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/pojo/ProductProcess.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/controller/PlanController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/mapper/PlanMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/mapper/PlanNodeMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/pojo/Plan.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/pojo/PlanNode.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/service/PlanService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/PlanNodeVo.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/PlanVo.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/SavePlanNodeVo.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/SavePlanVo.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/SearchPlanVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderDto.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/dto/PerformanceShiftAddDto.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/dto/PerformanceShiftMapDto.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/dto/PersonalAttendanceRecordsDto.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/mapper/PersonalShiftMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/pojo/PersonalAttendanceLocationConfig.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/pojo/PersonalShift.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/service/PersonalShiftService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/service/impl/PersonalShiftServiceImpl.java 488 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/task/PersonalAttendanceRecordsTask.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/utils/JackSonUtil.java 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/utils/StyleMonthUtils.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/utils/StyleYearUtils.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/ProductOrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/SalesLedgerWorkMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/projectManagement/PlanMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/projectManagement/PlanNodeMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/ShipmentApprovalMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/ShippingInfoMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/staff/PersonalShiftMapper.xml 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/20260306_create_purchase_return_orders.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
#产品退货单表
drop table if exists purchase_return_orders;
create table purchase_return_orders
(
    id                 bigint auto_increment primary key,
    no                 varchar(255) null comment '退货单编号',
    return_type        tinyint not null default 0 comment '退货方式 0退货退款 1拒收',
    supplier_id        bigint  not null default 0 comment '供应商id',
    project_id         bigint  not null default 0 comment '项目id',
    project_phase      tinyint not null default 0 comment '项目阶段',
    prepared_at        datetime null comment '制单日期',
    prepared_user_id   bigint  not null default 0 comment '制单人id',
    return_user_id     bigint  not null default 0 comment '退料人id',
    purchase_ledger_id bigint  not null default 0 comment '采购订单id',
    total_discount_amount decimal(10, 2) null comment '整单折扣额',
    total_discount_rate   decimal(10, 2) null comment '整单折扣率',
    total_amount decimal(10,2) null comment '成交金额',
    remark             text null comment '备注',
    create_time        datetime null comment '录入时间',
    update_time        datetime null comment '更新时间',
    index              idx_supplier_id (supplier_id),
    index              idx_purchase_ledger_id (purchase_ledger_id),
    index              idx_project_id (project_id)
);
#产品退货单与采购产品关联表
drop table if exists purchase_return_order_products;
create table purchase_return_order_products
(
    id                       bigint auto_increment primary key,
    purchase_return_order_id bigint not null default 0 comment '退货单id',
    sales_ledger_product_id  bigint not null default 0 comment '采购产品id',
    create_time              datetime null comment '录入时间',
    update_time              datetime null comment '更新时间',
    index                    idx_purchase_return_order_id (purchase_return_order_id),
    index                    idx_sales_ledger_product_id (sales_ledger_product_id)
);
pom.xml
@@ -39,6 +39,7 @@
        <tomcat.version>9.0.102</tomcat.version>
        <minio.version>8.4.3</minio.version>
        <okhttp.version>4.9.0</okhttp.version>
        <hutool.version>5.8.18</hutool.version>
        <logback.version>1.2.13</logback.version>
        <spring-security.version>5.7.12</spring-security.version>
        <spring-framework.version>5.3.39</spring-framework.version>
@@ -315,6 +316,20 @@
            <scope>compile</scope>
        </dependency>
        <!--hutool工具包-->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>${hutool.version}</version>
        </dependency>
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.8.43</version>
        </dependency>
    </dependencies>
    <build>
src/main/java/com/ruoyi/ScheduleTask.java
@@ -55,4 +55,6 @@
                .eq(SysNotice::getStatus,"1")
                .lt(SysNotice::getCreateTime, LocalDateTime.now()));
    }
}
src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -15,6 +15,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.basic.dto.CustomerFollowUpFileDto;
import com.ruoyi.common.utils.SecurityUtils;
import java.util.List;
@@ -86,8 +88,27 @@
    @PostMapping("/upload/{followUpId}")
    @Log(title = "客户跟进-上传附件", businessType = BusinessType.INSERT)
    public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) {
        customerFollowUpService.addFollowUpFiles(files, followUpId);
        return AjaxResult.success();
        return AjaxResult.success(customerFollowUpService.addFollowUpFiles(files, followUpId));
    }
    /**
     * ä¸Šä¼ è·Ÿè¿›é™„件(复用,无ID)
     */
    @ApiOperation("上传附件(复用)")
    @PostMapping("/upload")
    @Log(title = "上传附件(复用)", businessType = BusinessType.INSERT)
    public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) {
        List<CustomerFollowUpFileDto> uploadedFiles = customerFollowUpService.addFollowUpFiles(files, null);
        return AjaxResult.success(uploadedFiles);
    }
    /**
     * æ‰¹é‡æŸ¥è¯¢é™„件列表
     */
    @ApiOperation("批量查询附件列表")
    @PostMapping("/file/list")
    public AjaxResult getFileList(@RequestBody List<Long> ids) {
        return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids));
    }
    /**
src/main/java/com/ruoyi/basic/dto/CustomerFollowUpFileDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.basic.dto;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * å®¢æˆ·è·Ÿè¿›é™„ä»¶DTO
 *
 * @author deslrey
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CustomerFollowUpFileDto extends CustomerFollowUpFile {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸Šä¼ è€…姓名
     */
    private String createUserName;
    /**
     * ä¿®æ”¹è€…姓名
     */
    private String updateUserName;
}
src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java
@@ -2,6 +2,14 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import com.ruoyi.common.vo.SimpleFileVo;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
/**
 * <br>
@@ -13,4 +21,18 @@
 * @since 2026/03/04 14:52
 */
public interface CustomerFollowUpFileService extends IService<CustomerFollowUpFile> {
    /**
     * æ ¹æ® xx,xxx,xx批量查询并且出插入SimpleFileVo进入
     * @param list
     * @param getAttachmentIds
     * @param setAttachmentList
     * @param <T>
     */
    <T> void fillAttachment(
           @Nullable List<T> list,
           @NotNull Function<T, String> getAttachmentIds,
           @NotNull BiConsumer<T, List<SimpleFileVo>> setAttachmentList
    );
}
src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.CustomerFollowUpDto;
import com.ruoyi.basic.pojo.CustomerFollowUp;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.basic.dto.CustomerFollowUpFileDto;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import org.springframework.web.multipart.MultipartFile;
import java.util.Collection;
import java.util.List;
/**
@@ -41,7 +43,7 @@
    /**
     * æ·»åŠ è·Ÿè¿›é™„ä»¶
     */
    void addFollowUpFiles(List<MultipartFile> files, Integer followUpId);
    List<CustomerFollowUpFileDto> addFollowUpFiles(List<MultipartFile> files, Integer followUpId);
    /**
     * åˆ é™¤è·Ÿè¿›é™„ä»¶
@@ -49,6 +51,11 @@
    void deleteFollowUpFile(Integer fileId);
    /**
     * æ ¹æ®é™„ä»¶ID集合获取附件列表
     */
    List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds);
    /**
     * èŽ·å–è·Ÿè¿›è¯¦æƒ…
     */
    CustomerFollowUpDto getFollowUpWithFiles(Integer id);
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
@@ -1,10 +1,22 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.stream.CollectorUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.ruoyi.basic.mapper.CustomerFollowUpFileMapper;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.service.CustomerFollowUpService;
import com.ruoyi.common.vo.SimpleFileVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
 * <br>
@@ -16,5 +28,46 @@
 * @since 2026/03/04 14:53
 */
@Service
@RequiredArgsConstructor
public class CustomerFollowUpFileServiceImpl extends ServiceImpl<CustomerFollowUpFileMapper, CustomerFollowUpFile> implements CustomerFollowUpFileService {
    private final CustomerFollowUpService customerFollowUpService;
    @Override
    public <T> void fillAttachment(List<T> list, Function<T, String> getAttachmentIds, BiConsumer<T, List<SimpleFileVo>> setAttachmentList) {
        if (CollUtil.isEmpty(list)) {
            return;
        }
        // æ”¶é›†æ‰€æœ‰æ–‡ä»¶ID
        Set<Long> ids = list.stream()
                .map(getAttachmentIds)
                .filter(StrUtil::isNotBlank)
                .flatMap(s -> Arrays.stream(s.split(",")))
                .map(Long::valueOf)
                .collect(Collectors.toSet());
        List<CustomerFollowUpFile> followUpFilesByIds = new ArrayList<>();
        Lists.partition(Lists.newArrayList(ids), 999).forEach(it -> {
            followUpFilesByIds.addAll(
                    customerFollowUpService.getFollowUpFilesByIds(it)
            );
        });
        if (CollUtil.isEmpty(followUpFilesByIds)) {
            return;
        }
        Map<Long, SimpleFileVo> collectMap = followUpFilesByIds.stream().map(SimpleFileVo::convert).collect(Collectors.toMap(
                SimpleFileVo::getId,
                Function.identity()
        ));
        list.forEach(t -> {
            String attachmentIds = getAttachmentIds.apply(t);
            if (StrUtil.isNotBlank(attachmentIds)) {
                List<SimpleFileVo> fileVos = Arrays.stream(attachmentIds.split(","))
                        .map(Long::valueOf)
                        .map(it->collectMap.getOrDefault(it, (SimpleFileVo) Collections.emptyList()))
                        .collect(Collectors.toList());
                setAttachmentList.accept(t, fileVos);
            }
        });
    }
}
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -8,10 +8,12 @@
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.service.CustomerFollowUpService;
import com.ruoyi.basic.service.ICustomerService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.basic.dto.CustomerFollowUpFileDto;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysUserService;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
@@ -28,7 +30,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
@@ -49,6 +51,9 @@
    @Value("${file.upload-dir}")
    private String uploadDir;
    @Autowired
    private ISysUserService sysUserService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -78,8 +83,8 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addFollowUpFiles(List<MultipartFile> files, Integer followUpId) {
        handleFollowUpFiles(files, followUpId);
    public List<CustomerFollowUpFileDto> addFollowUpFiles(List<MultipartFile> files, Integer followUpId) {
        return handleFollowUpFiles(files, followUpId);
    }
    @Override
@@ -136,14 +141,27 @@
        }
    }
    private void handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) {
    @Override
    public List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds) {
        if (fileIds == null || fileIds.isEmpty()) {
            return new ArrayList<>(0);
        }
        LambdaQueryWrapper<CustomerFollowUpFile> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(CustomerFollowUpFile::getId, fileIds)
                .select(CustomerFollowUpFile::getId, CustomerFollowUpFile::getFileUrl, CustomerFollowUpFile::getFileName);
        return customerFollowUpFileService.list(queryWrapper);
    }
    private List<CustomerFollowUpFileDto> handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) {
        List<CustomerFollowUpFile> fileList = new ArrayList<>();
        List<CustomerFollowUpFileDto> dtoList = new ArrayList<>();
        if (multipartFiles == null || multipartFiles.isEmpty()) {
            return;
            return dtoList;
        }
        Long currentUserId = SecurityUtils.getUserId();
        Long currentTenantId = SecurityUtils.getLoginUser().getTenantId();
        List<CustomerFollowUpFile> fileList = new ArrayList<>();
        for (MultipartFile file : multipartFiles) {
            if (file == null || file.isEmpty()) {
@@ -159,7 +177,8 @@
                String originalFilename = file.getOriginalFilename();
                String fileExtension = FilenameUtils.getExtension(originalFilename);
                String formalFilename = followUpId + "_" +
                String prefix = (followUpId != null) ? followUpId.toString() : "temp";
                String formalFilename = prefix + "_" +
                        System.currentTimeMillis() + "_" +
                        UUID.randomUUID().toString().substring(0, 8) +
                        (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
@@ -184,7 +203,35 @@
        }
        if (!fileList.isEmpty()) {
            customerFollowUpFileService.saveBatch(fileList);
            return convertToDtoList(fileList);
        }
        return dtoList;
    }
    private List<CustomerFollowUpFileDto> convertToDtoList(List<CustomerFollowUpFile> fileList) {
        List<CustomerFollowUpFileDto> dtoList = new ArrayList<>();
        if (fileList == null || fileList.isEmpty()) {
            return dtoList;
        }
        for (CustomerFollowUpFile entity : fileList) {
            CustomerFollowUpFileDto dto = new CustomerFollowUpFileDto();
            BeanUtils.copyProperties(entity, dto);
            if (entity.getCreateUser() != null) {
                SysUser createUser = sysUserService.selectUserById(entity.getCreateUser());
                if (createUser != null) {
                    dto.setCreateUserName(createUser.getNickName());
                }
            }
            if (entity.getUpdateUser() != null) {
                SysUser updateUser = sysUserService.selectUserById(entity.getUpdateUser());
                if (updateUser != null) {
                    dto.setUpdateUserName(updateUser.getNickName());
                }
            }
            dtoList.add(dto);
        }
        return dtoList;
    }
    private void validateFollowUp(CustomerFollowUp followUp) {
src/main/java/com/ruoyi/common/enums/ProcessType.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.ruoyi.common.enums;
public enum ProcessType implements BaseEnum<Integer>{
    TIMEKEEPING(1, "计时"),
    PIECERATE(2, "计件");
    private final Integer code;
    private final String value;
    ProcessType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }
    @Override
    public Integer getCode() {
        return this.code;
    }
    @Override
    public String getValue() {
        return this.value;
    }
}
src/main/java/com/ruoyi/common/vo/SimpleFileVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.ruoyi.common.vo;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
 * @author buhuazhen
 * @date 2026/3/6
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SimpleFileVo implements Serializable {
    private Long id;
    private String fileName;
    private String fileUrl;
    public static SimpleFileVo convert(@NotNull CustomerFollowUpFile file){
        return new SimpleFileVo(file.getId(), file.getFileName(), file.getFileUrl());
    }
}
src/main/java/com/ruoyi/procurementrecord/controller/ReturnManagementController.java
@@ -1,14 +1,20 @@
package com.ruoyi.procurementrecord.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.service.ReturnManagementService;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
import com.ruoyi.procurementrecord.service.impl.ReturnSaleProductServiceImpl;
import com.ruoyi.sales.dto.SalesLedgerDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,48 +28,69 @@
 * @date : 2025/9/17 10:34
 */
@RestController
@Api(tags = "到货管理")
@Api(tags = "销售退货")
@RequestMapping("/returnManagement")
public class ReturnManagementController extends BaseController {
    @Autowired
    private ReturnManagementService returnManagementService;
    @Autowired
    private ReturnManagementMapper returnManagementMapper;
    private ReturnSaleProductService returnSaleProductService;
    @GetMapping("/listPage")
    @ApiOperation("到货管理-查询")
    public AjaxResult listPage(Page page, ReturnManagement returnManagement) {
        IPage<ReturnManagement> result = returnManagementService.listPage(page, returnManagement);
    @ApiOperation("销售退货-查询")
    public AjaxResult listPage(Page page, ReturnManagementDto returnManagement) {
        IPage<ReturnManagementDto> result = returnManagementService.listPage(page, returnManagement);
        return AjaxResult.success(result);
    }
    @PostMapping("/add")
    @ApiOperation("到货管理-添加")
    @ApiOperation("销售退货-添加")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult add(@RequestBody ReturnManagement returnManagement) {
        String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT");
        returnManagement.setReturnNo(rt);
        boolean result = returnManagementService.save(returnManagement);
        return result ? success() : error();
    public AjaxResult add(@RequestBody ReturnManagementDto returnManagementDto) {
        return returnManagementService.addReturnManagementDto(returnManagementDto) ? success() : error();
    }
    @PostMapping("/update")
    @ApiOperation("到货管理-修改")
    @ApiOperation("销售退货-修改")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult update(@RequestBody ReturnManagement returnManagement) {
        boolean result = returnManagementService.updateById(returnManagement);
        return result ? success() : error();
    public AjaxResult update(@RequestBody ReturnManagementDto returnManagementDto) {
        return returnManagementService.updateReturnManagementDto(returnManagementDto) ? success() : error();
    }
    @ApiOperation("销售退货-处理退货单")
    @GetMapping("/handle")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult handle(Long returnManagementId) {
        return returnManagementService.handle(returnManagementId) ? success() : error();
    }
    @DeleteMapping("/del")
    @ApiOperation("到货管理-删除")
    @ApiOperation("销售退货-删除")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult del(@RequestBody List<Long> ids) {
        if (CollectionUtils.isEmpty(ids)) return error("请选择至少一条数据");
        returnSaleProductService.remove(new QueryWrapper<ReturnSaleProduct>()
                .lambda()
                .in(ReturnSaleProduct::getReturnManagementId, ids));
        boolean result = returnManagementService.removeByIds(ids);
        return result ? success() : error();
    }
    @GetMapping("/getById")
    @ApiOperation("销售退货-根据id查询")
    public AjaxResult getById(Long returnManagementId) {
        ReturnManagementDto returnManagementDto = returnManagementService.getReturnManagementDtoById(returnManagementId);
        return success(returnManagementDto);
    }
    @GetMapping("/getByShippingId")
    @ApiOperation("销售退货-根据出库单查询销售订单以及产品信息")
    public AjaxResult getByShippingId(Long shippingId) {
        SalesLedgerDto salesLedgerDto = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId);
        return success(salesLedgerDto);
    }
}
src/main/java/com/ruoyi/procurementrecord/controller/ReturnSaleProductController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.procurementrecord.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * <p>
 * é€€è´§äº§å“è¡¨ å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:57:42
 */
@RestController
@RequestMapping("/returnSaleProduct")
public class ReturnSaleProductController {
}
src/main/java/com/ruoyi/procurementrecord/dto/ReturnManagementDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
package com.ruoyi.procurementrecord.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
 * @author :yys
 * @date : 2025/9/17 10:28
 */
@Data
public class ReturnManagementDto extends ReturnManagement {
    @ApiModelProperty(value = "客户名称")
    private String customerName;
    @ApiModelProperty(value = "销售单号")
    private String salesContractNo;
    @ApiModelProperty(value = "业务员")
    private String salesman;
    @ApiModelProperty("关联出库单号")
    private String shippingNo;
    @ApiModelProperty(value = "项目名称")
    private String projectName;
    @ApiModelProperty(value = "销售台账id")
    private Long salesLedgerId;
    @ApiModelProperty(value = "销售产品对象数组")
    private List<ReturnSaleProductDto> returnSaleProducts;
}
src/main/java/com/ruoyi/procurementrecord/dto/ReturnSaleProductDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.procurementrecord.dto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ReturnSaleProductDto extends ReturnSaleProduct {
    private String productName;
    private String model;
    private String unit;
    //未退货数量
    private BigDecimal unQuantity;
    private BigDecimal totalReturnNum;
}
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnManagementMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import org.apache.ibatis.annotations.Param;
@@ -18,5 +19,7 @@
     * @param page
     * @return
     */
    IPage<ReturnManagement> listPage(Page page,@Param("req") ReturnManagement returnManagement);
    IPage<ReturnManagementDto> listPage(Page page, @Param("req") ReturnManagementDto returnManagement);
    ReturnManagementDto getReturnManagementDtoById(Long id);
}
src/main/java/com/ruoyi/procurementrecord/mapper/ReturnSaleProductMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.ruoyi.procurementrecord.mapper;
import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
 * é€€è´§äº§å“è¡¨ Mapper æŽ¥å£
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:57:42
 */
@Mapper
public interface ReturnSaleProductMapper extends BaseMapper<ReturnSaleProduct> {
    List<ReturnSaleProductDto> listReturnSaleProductDto(@Param("returnManagementId") Long returnManagementId);
}
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnManagement.java
@@ -29,44 +29,39 @@
    @ApiModelProperty(value = "退货单号")
    private String returnNo;
    @ApiModelProperty(value = "关联单号")
    private String relatedNo;
    @ApiModelProperty("客户id")
    private Long customerId;
    @ApiModelProperty(value = "退货类型")
    private String returnType;
    @ApiModelProperty("关联出库单号Id")
    private Long shippingId;
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
    @ApiModelProperty("项目id")
    private Long projectId;
    @ApiModelProperty(value = "退货原因")
    private String returnReason;
    @ApiModelProperty("项目阶段")
    private String projectStage;
    @ApiModelProperty(value = "退货状态")
    private String status;
    @ApiModelProperty("制单人")
    private String maker;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("制单时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime makeTime;
    @ApiModelProperty("结算人")
    private String settler;
    @ApiModelProperty("状态")
    private Integer status;
    @ApiModelProperty("创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "创建用户")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "修改用户")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "租户ID")
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;
}
src/main/java/com/ruoyi/procurementrecord/pojo/ReturnSaleProduct.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package com.ruoyi.procurementrecord.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
 * <p>
 * é€€è´§äº§å“è¡¨
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:57:42
 */
@Getter
@Setter
@TableName("return_sale_product")
@ApiModel(value = "ReturnSaleProduct对象", description = "退货产品表")
public class ReturnSaleProduct implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("退货单id")
    private Long returnManagementId;
    @ApiModelProperty("退货产品id")
    private Long returnSaleLedgerProductId;
    @ApiModelProperty("退货产品数量")
    private BigDecimal num;
    @ApiModelProperty("退货状态 0 æœªé€€å›ž 1已退货")
    private Integer status;
}
src/main/java/com/ruoyi/procurementrecord/service/ReturnManagementService.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.sales.dto.SalesLedgerDto;
/**
 * @author :yys
@@ -18,5 +20,15 @@
     * @param returnManagement
     * @return
     */
    IPage<ReturnManagement> listPage(Page page, ReturnManagement returnManagement);
    IPage<ReturnManagementDto> listPage(Page page, ReturnManagementDto returnManagement);
    boolean addReturnManagementDto(ReturnManagementDto returnManagementDto);
    boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto);
    SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId);
    boolean handle(Long returnManagementId);
    ReturnManagementDto getReturnManagementDtoById(Long returnManagementId);
}
src/main/java/com/ruoyi/procurementrecord/service/ReturnSaleProductService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.ruoyi.procurementrecord.service;
import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
 * <p>
 * é€€è´§äº§å“è¡¨ æœåŠ¡ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:57:42
 */
public interface ReturnSaleProductService extends IService<ReturnSaleProduct> {
    List<ReturnSaleProductDto> listReturnSaleProductDto(Long returnManagementId);
}
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnManagementServiceImpl.java
@@ -3,12 +3,27 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.procurementrecord.dto.ReturnManagementDto;
import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper;
import com.ruoyi.procurementrecord.pojo.ReturnManagement;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.service.ReturnManagementService;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.ShippingInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
 * @author :yys
@@ -21,9 +36,71 @@
    @Autowired
    private ReturnManagementMapper returnManagementMapper;
    @Autowired
    private ReturnSaleProductService returnSaleProductService;
    @Autowired
    private ShippingInfoService shippingInfoService;
    @Autowired
    private SalesLedgerMapper salesLedgerMapper;
    @Override
    public IPage<ReturnManagement> listPage(Page page, ReturnManagement returnManagement) {
        IPage<ReturnManagement> returnManagementIPage =  returnManagementMapper.listPage(page, returnManagement);
    public IPage<ReturnManagementDto> listPage(Page page, ReturnManagementDto returnManagement) {
        IPage<ReturnManagementDto> returnManagementIPage = returnManagementMapper.listPage(page, returnManagement);
        return returnManagementIPage;
    }
    @Override
    public boolean addReturnManagementDto(ReturnManagementDto returnManagementDto) {
        String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT");
        returnManagementDto.setReturnNo(rt);
        save(returnManagementDto);
        for (ReturnSaleProduct returnSaleProduct : returnManagementDto.getReturnSaleProducts()) {
            returnSaleProduct.setReturnManagementId(returnManagementDto.getId());
            returnSaleProduct.setStatus(0);
            returnSaleProductService.save(returnSaleProduct);
        }
        return true;
    }
    @Override
    public boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto) {
        List<ReturnSaleProduct> returnSaleProducts = new ArrayList<>();
        if (!CollectionUtils.isEmpty(returnManagementDto.getReturnSaleProducts())) {
            returnManagementDto.getReturnSaleProducts().stream().forEach(returnSaleProductDto -> {
                ReturnSaleProduct returnSaleProduct = new ReturnSaleProduct();
                BeanUtils.copyProperties(returnSaleProductDto, returnSaleProduct);
                returnSaleProducts.add(returnSaleProduct);
            });
        }
        returnSaleProductService.updateBatchById(returnSaleProducts);
        return updateById(returnManagementDto);
    }
    @Override
    public SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId) {
        ShippingInfo byId = shippingInfoService.getById(shippingId);
        SalesLedger salesLedger = salesLedgerMapper.selectById(byId.getSalesLedgerId());
        SalesLedgerDto salesLedgerDto = new SalesLedgerDto();
        BeanUtils.copyProperties(salesLedger, salesLedgerDto);
        List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId());
        salesLedgerDto.setProductDtoData(salesLedgerProductDtos);
         return salesLedgerDto;
    }
    @Override
    public boolean handle(Long returnManagementId) {
        ReturnManagement byId = this.getById(returnManagementId);
        byId.setStatus(1);
        updateById(byId);
        return true;
    }
    @Override
    public ReturnManagementDto getReturnManagementDtoById(Long returnManagementId) {
        ReturnManagementDto returnManagementDtoById = returnManagementMapper.getReturnManagementDtoById(returnManagementId);
        returnManagementDtoById.setReturnSaleProducts(returnSaleProductService.listReturnSaleProductDto(returnManagementId));
        return returnManagementDtoById;
    }
}
src/main/java/com/ruoyi/procurementrecord/service/impl/ReturnSaleProductServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.ruoyi.procurementrecord.service.impl;
import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct;
import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper;
import com.ruoyi.procurementrecord.service.ReturnSaleProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
 * <p>
 * é€€è´§äº§å“è¡¨ æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:57:42
 */
@Service
public class ReturnSaleProductServiceImpl extends ServiceImpl<ReturnSaleProductMapper, ReturnSaleProduct> implements ReturnSaleProductService {
    @Autowired
    private ReturnSaleProductMapper returnSaleProductMapper;
    @Override
    public List<ReturnSaleProductDto> listReturnSaleProductDto(Long returnManagementId) {
        return returnSaleProductMapper.listReturnSaleProductDto(returnManagementId);
    }
}
src/main/java/com/ruoyi/production/pojo/ProductProcess.java
@@ -50,6 +50,9 @@
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal salaryQuota;
    @ApiModelProperty("类型 åŒºåˆ†æ˜¯è®¡æ—¶è¿˜æ˜¯è®¡ä»¶ 0 è®¡æ—¶ 1计件")
    private Long type;
    /**
     * åˆ›å»ºæ—¶é—´
     */
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -234,13 +234,17 @@
                }
            }
            productOrderMapper.updateById(productOrder);
            /*添加生产核算*/
            /*添加生产核算        åŒºåˆ†å·¥åºæ˜¯è®¡ä»¶è¿˜æ˜¯è®¡æ—¶*/
            BigDecimal workHours = (productProcess.getType() == 1)
                    ? productProcess.getSalaryQuota().multiply(productQty)
                    : productProcess.getSalaryQuota();
            SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder()
                    .productMainId(productionProductMain.getId())
                    .schedulingUserId(user.getUserId())
                    .schedulingUserName(user.getNickName())
                    .finishedNum(productQty)
                    .workHours(productProcess.getSalaryQuota())
                    .workHours(workHours)
                    .process(productProcess.getName())
                    .schedulingDate(LocalDate.now())
                    .tenantId(dto.getTenantId())
src/main/java/com/ruoyi/projectManagement/controller/PlanController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package com.ruoyi.projectManagement.controller;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.projectManagement.service.PlanService;
import com.ruoyi.projectManagement.vo.SavePlanNodeVo;
import com.ruoyi.projectManagement.vo.SavePlanVo;
import com.ruoyi.projectManagement.vo.SearchPlanVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
 * @author buhuazhen
 * @date 2026/3/7
 * @email 3038525872@qq.com
 */
@RestController
@RequestMapping("/projectManagement/plan")
@Api(value = "PlanController", tags = "项目管理计划表(项目管理类型)")
@RequiredArgsConstructor
public class PlanController {
    private final PlanService planService;
    @PostMapping("/save")
    @ApiOperation("保存")
    public AjaxResult save(@RequestBody @Valid SavePlanVo savePlanVo) {
        planService.savePlan(savePlanVo);
        return AjaxResult.success();
    }
    @PostMapping("/delete/{id}")
    @ApiOperation("删除")
    public AjaxResult delete(@PathVariable Long id) {
        planService.deletePlan(id);
        return AjaxResult.success();
    }
    @PostMapping("/listPage")
    @ApiOperation("分页列表")
    public AjaxResult listPage(@RequestBody SearchPlanVo searchPlanVo) {
        return AjaxResult.success(planService.searchPlan(searchPlanVo));
    }
}
src/main/java/com/ruoyi/projectManagement/mapper/PlanMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.projectManagement.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.projectManagement.pojo.Plan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.projectManagement.vo.SearchPlanVo;
/**
* @author buhuazhen
* @description é’ˆå¯¹è¡¨ã€project_management_plan(项目管理计划表(项目管理类型))】的数据库操作Mapper
* @createDate 2026-03-06 15:29:26
* @Entity generator.domain.ProjectManagementPlan
*/
public interface PlanMapper extends BaseMapper<Plan> {
    IPage<Plan> selectPlanPage(SearchPlanVo searchPlanVo);
}
src/main/java/com/ruoyi/projectManagement/mapper/PlanNodeMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.projectManagement.mapper;
import com.ruoyi.projectManagement.pojo.PlanNode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author buhuazhen
* @description é’ˆå¯¹è¡¨ã€project_management_plan_node(计划节点)】的数据库操作Mapper
* @createDate 2026-03-06 17:05:38
* @Entity generator.domain.ProjectManagementPlanNode
*/
public interface PlanNodeMapper extends BaseMapper<PlanNode> {
}
src/main/java/com/ruoyi/projectManagement/pojo/Plan.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,84 @@
package com.ruoyi.projectManagement.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * é¡¹ç›®ç®¡ç†è®¡åˆ’表(项目管理类型)
 * @TableName project_management_plan
 */
@TableName(value ="project_management_plan")
@Data
@ApiModel(description="项目管理计划表(项目管理类型)")
public class Plan {
    /**
     *
     */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value="主键ID")
    private Long id;
    /**
     * è®¡åˆ’名称
     */
    @TableField(value = "name")
    @ApiModelProperty(value="计划名称")
    private String name;
    /**
     * è®¡åˆ’描述
     */
    @TableField(value = "description")
    @ApiModelProperty(value="计划描述")
    private String description;
    /**
     * é™„ä»¶ ,进行分割
     */
    @TableField(value = "attachment")
    @ApiModelProperty(value="附件")
    private String attachment;
    /**
     *
     */
    @TableField(value = "is_delete")
    @ApiModelProperty(value="是否删除")
    private Integer isDelete;
    /**
     *
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @ApiModelProperty(value="创建时间")
    private LocalDateTime createTime;
    /**
     *
     */
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value="更新时间")
    private LocalDateTime updateTime;
    /**
     *
     */
    @TableField(value = "create_user",fill = FieldFill.INSERT)
    @ApiModelProperty(value="创建人")
    private Integer createUser;
    /**
     *
     */
    @TableField(value = "update_user",fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value="更新人")
    private Integer updateUser;
}
src/main/java/com/ruoyi/projectManagement/pojo/PlanNode.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,104 @@
package com.ruoyi.projectManagement.pojo;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
 * è®¡åˆ’节点
 * @TableName project_management_plan_node
 */
@TableName(value ="project_management_plan_node")
@Data
public class PlanNode implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    @TableField(value = "id")
    private Long id;
    /**
     * å¯¹åº”id
     */
    @TableField(value = "project_management_plan_id")
    private Long projectManagementPlanId;
    /**
     * æŽ’序
     */
    @TableField(value = "sort")
    private Integer sort;
    /**
     * é˜¶æ®µåç§°
     */
    @TableField(value = "name")
    private String name;
    /**
     * è´Ÿè´£ä»»ID
     */
    @TableField(value = "leader_id")
    private Long leaderId;
    /**
     * è´Ÿè´£ä»»åç§°
     */
    @TableField(value = "leader_name")
    private String leaderName;
    /**
     * é¢„计工期(天)
     */
    @TableField(value = "estimated_duration")
    private Integer estimatedDuration;
    /**
     * å·¥ä»·
     */
    @TableField(value = "hourly_rate")
    private String hourlyRate;
    /**
     * ä½œä¸šå†…容
     */
    @TableField(value = "work_content")
    private String workContent;
    /**
     *
     */
    @TableField(value = "is_delete")
    private Integer isDelete;
    /**
     *
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    /**
     *
     */
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     *
     */
    @TableField(value = "create_user",fill = FieldFill.INSERT)
    private Integer createUser;
    /**
     *
     */
    @TableField(value = "update_user",fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
src/main/java/com/ruoyi/projectManagement/service/PlanService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
package com.ruoyi.projectManagement.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.projectManagement.pojo.Plan;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.projectManagement.vo.PlanVo;
import com.ruoyi.projectManagement.vo.SavePlanNodeVo;
import com.ruoyi.projectManagement.vo.SavePlanVo;
import com.ruoyi.projectManagement.vo.SearchPlanVo;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;
/**
* @author buhuazhen
* @description é’ˆå¯¹è¡¨ã€project_management_plan(项目管理计划表(项目管理类型))】的数据库操作Service
* @createDate 2026-03-06 15:29:26
*/
public interface PlanService{
    /**
     * ä¿å­˜é¡¹ç›®ç®¡ç†è®¡åˆ’
     * @param savePlanVo
     */
    void savePlan(@NotNull SavePlanVo savePlanVo);
    /**
     * ä¿å­˜è®¡åˆ’节点
     * @param planId
     * @param savePlanNodeVos
     */
    void savePlanNode(@NotNull Long planId,@Nullable List<SavePlanNodeVo> savePlanNodeVos);
    /**
     * åˆ é™¤é¡¹ç›®ç®¡ç†è®¡åˆ’
     * @param id
     */
    void deletePlan(@NotNull Long id);
    void deletePlanNode(@Nullable List<Long> ids);
    IPage<PlanVo> searchPlan(@NotNull SearchPlanVo searchPlanVo);
}
src/main/java/com/ruoyi/projectManagement/service/impl/PlanServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,148 @@
package com.ruoyi.projectManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.projectManagement.mapper.PlanMapper;
import com.ruoyi.projectManagement.mapper.PlanNodeMapper;
import com.ruoyi.projectManagement.pojo.Plan;
import com.ruoyi.projectManagement.pojo.PlanNode;
import com.ruoyi.projectManagement.service.PlanService;
import com.ruoyi.projectManagement.vo.*;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
 * @author buhuazhen
 * @description é¡¹ç›®ç®¡ç†è®¡åˆ’的实现
 * @createDate 2026-03-06 15:29:26
 */
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class PlanServiceImpl implements PlanService {
    private final PlanMapper planMapper;
    private final CustomerFollowUpFileService customerFollowUpFileService;
    private final PlanNodeMapper planNodeMapper;
    @Lazy
    @Autowired
    private PlanService planService;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void savePlan(SavePlanVo savePlanVo) {
        Plan plan = BeanUtil.copyProperties(savePlanVo, Plan.class);
        // é™„件处理 , æ‹¼æŽ¥
        String attachments = String.join(",", Optional.ofNullable(savePlanVo.getAttachmentIds()).orElse(Collections.emptyList()));
        plan.setAttachment(attachments);
        if (savePlanVo.getId() == null) {
            planMapper.insert(plan);
        } else {
            planMapper.updateById(plan);
        }
        planService.savePlanNode(plan.getId(), savePlanVo.getSavePlanNodeList());
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void savePlanNode(Long planId, @Nullable List<SavePlanNodeVo> savePlanNodeVos) {
        Assert.notNull(planId, () -> new ServiceException("计划ID不能为空"));
        if (CollUtil.isEmpty(savePlanNodeVos)) {
            return;
        }
        // åˆ é™¤å¤šä½™èŠ‚ç‚¹
        List<Long> existNodeIds = savePlanNodeVos.stream().map(SavePlanNodeVo::getId).filter(Objects::nonNull).collect(Collectors.toList());
        LambdaQueryWrapper<PlanNode> planNodeLambdaQueryWrapper = new LambdaQueryWrapper<PlanNode>()
                .select(PlanNode::getId)
                .eq(PlanNode::getProjectManagementPlanId, planId);
        if(CollUtil.isNotEmpty(existNodeIds)){
            planNodeLambdaQueryWrapper.notIn(PlanNode::getId, existNodeIds);
        }
        List<PlanNode> needDeleteNode = planNodeMapper.selectList(planNodeLambdaQueryWrapper);
        deletePlanNode(needDeleteNode.stream().map(PlanNode::getId).collect(Collectors.toList()));
        List<PlanNode> planNodes = BeanUtil.copyToList(savePlanNodeVos, PlanNode.class);
        // è®¾ç½®æŽ’序索引
        IntStream.range(0, savePlanNodeVos.size()).forEach(i -> {
            planNodes.get(i).setSort(i);
            planNodes.get(i).setProjectManagementPlanId(planId);
            if (planNodes.get(i).getId() == null) {
                planNodeMapper.insert(planNodes.get(i));
            } else {
                planNodeMapper.updateById(planNodes.get(i));
            }
        });
    }
    private List<PlanNode> getPlanNodeByPlanId(Long planId) {
        return planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>()
                .eq(PlanNode::getIsDelete, 0)
                .eq(PlanNode::getProjectManagementPlanId, planId));
    }
    private List<PlanNode> getPlanNodeByPlanIds(List<Long> planIds) {
        return planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>()
                .eq(PlanNode::getIsDelete, 0)
                .in(PlanNode::getProjectManagementPlanId, planIds));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deletePlan(Long id) {
        planMapper.update(null,
                new LambdaUpdateWrapper<Plan>()
                        .eq(Plan::getId, id)
                        .set(Plan::getIsDelete, 1));
        planService.deletePlanNode(getPlanNodeByPlanId(id).stream().map(PlanNode::getId).collect(Collectors.toList()));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deletePlanNode(List<Long> ids) {
        if (CollUtil.isNotEmpty(ids)) {
            planNodeMapper.update(null,
                    new LambdaUpdateWrapper<PlanNode>()
                            .in(PlanNode::getId, ids)
                            .set(PlanNode::getIsDelete, 1));
        }
    }
    @Override
    public IPage<PlanVo> searchPlan(SearchPlanVo searchPlanVo) {
        IPage<Plan> planIPage = planMapper.selectPlanPage(searchPlanVo);
        IPage<PlanVo> resultPage = planIPage.convert(plan -> BeanUtil.copyProperties(plan, PlanVo.class));
        // æ–‡ä»¶èŽ·å–
        customerFollowUpFileService.fillAttachment(resultPage.getRecords(), PlanVo::getAttachment, PlanVo::setAttachmentList);
        Map<Long, List<PlanNodeVo>> collect = getPlanNodeByPlanIds(resultPage.getRecords().stream().map(PlanVo::getId).collect(Collectors.toList()))
                .stream()
                .map(it -> BeanUtil.copyProperties(it, PlanNodeVo.class))
                .collect(Collectors.groupingBy(PlanNodeVo::getProjectManagementPlanId, Collectors.toList()));
        resultPage.getRecords().forEach(planVo -> planVo.setPlanNodeList(collect.getOrDefault(planVo.getId(), Collections.emptyList())));
        return resultPage;
    }
}
src/main/java/com/ruoyi/projectManagement/vo/PlanNodeVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.ruoyi.projectManagement.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
 * @author buhuazhen
 * @date 2026/3/7
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PlanNodeVo implements Serializable {
    private Long id;
    private Long projectManagementPlanId;
    private Integer sort;
    private String name;
    private Long leaderId;
    private String leaderName;
    private Integer estimatedDuration;
    private String hourlyRate;
    private String workContent;
}
src/main/java/com/ruoyi/projectManagement/vo/PlanVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
package com.ruoyi.projectManagement.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.vo.SimpleFileVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
 * è®¡åˆ’VO
 * @author buhuazhen
 * @date 2026/3/6
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PlanVo implements Serializable {
    private Long id;
    private String name;
    private String description;
    // é™„ä»¶
    private List<SimpleFileVo> attachmentList;
    @JsonIgnore
    private String attachment;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    private List<PlanNodeVo> planNodeList;
}
src/main/java/com/ruoyi/projectManagement/vo/SavePlanNodeVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
package com.ruoyi.projectManagement.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
 * @author buhuazhen
 * @date 2026/3/7
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SavePlanNodeVo implements Serializable {
    private Long id;
    private Long projectManagementPlanId;
    private Integer sort;
    @NotBlank
    private String name;
    @NotNull
    private Long leaderId;
    @NotBlank
    private String leaderName;
    private Integer estimatedDuration;
    private String hourlyRate;
    private String workContent;
}
src/main/java/com/ruoyi/projectManagement/vo/SavePlanVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package com.ruoyi.projectManagement.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
 * @author buhuazhen
 * @date 2026/3/6
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SavePlanVo implements Serializable {
    private Long id;
    @NotBlank
    private String name;
    @NotBlank
    private String description;
    private List<String> attachmentIds;
    @Valid
    private List<SavePlanNodeVo> savePlanNodeList;
}
src/main/java/com/ruoyi/projectManagement/vo/SearchPlanVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.projectManagement.vo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
 * @author buhuazhen
 * @date 2026/3/6
 * @email 3038525872@qq.com
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
public class SearchPlanVo extends Page implements Serializable {
}
src/main/java/com/ruoyi/purchase/controller/PurchaseReturnOrdersController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package com.ruoyi.purchase.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.projectManagement.mapper.RolesMapper;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * <p>
 *  å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-06 11:44:38
 */
@RestController
@RequestMapping("/purchaseReturnOrders")
public class PurchaseReturnOrdersController {
    @Autowired
    private PurchaseReturnOrdersService purchaseReturnOrdersService;
    @Autowired
    private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
    @GetMapping("/listPage")
    public AjaxResult listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) {
        return AjaxResult.success(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto));
    }
    // æ–°å¢ž
    @Log(title = "采购退货单", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception {
        if (purchaseReturnOrderDto.getIsDefaultNo()) {
            purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL"));
        }
        return AjaxResult.success(purchaseReturnOrdersService.save(purchaseReturnOrderDto));
    }
}
src/main/java/com/ruoyi/purchase/dto/PurchaseReturnOrderDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.ruoyi.purchase.dto;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import lombok.Data;
@Data
public class PurchaseReturnOrderDto extends PurchaseReturnOrders {
    // æ˜¯å¦ä½¿ç”¨ç³»ç»Ÿå•号
    private Boolean isDefaultNo;
}
src/main/java/com/ruoyi/purchase/mapper/PurchaseReturnOrdersMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.purchase.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * <p>
 *  Mapper æŽ¥å£
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-06 11:44:38
 */
@Mapper
public interface PurchaseReturnOrdersMapper extends BaseMapper<PurchaseReturnOrders> {
    IPage<PurchaseReturnOrderVo> listPage(Page page, @Param("params") PurchaseReturnOrders purchaseReturnOrder);
}
src/main/java/com/ruoyi/purchase/pojo/PurchaseReturnOrders.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
package com.ruoyi.purchase.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
 * <p>
 *
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-06 11:44:38
 */
@Getter
@Setter
@TableName("purchase_return_orders")
@ApiModel(value = "PurchaseReturnOrders对象", description = "采购退货单")
public class PurchaseReturnOrders implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("退货单编号")
    private String no;
    @ApiModelProperty("退货方式 0退货退款 1拒收")
    private Integer returnType;
    @ApiModelProperty("供应商id")
    private Long supplierId;
    @ApiModelProperty("项目id")
    private Long projectId;
    @ApiModelProperty("项目阶段")
    private Integer projectPhase;
    @ApiModelProperty("制单日期")
    private LocalDateTime preparedAt;
    @ApiModelProperty("制单人id")
    private Long preparedUserId;
    @ApiModelProperty("退料人id")
    private Long returnUserId;
    @ApiModelProperty("采购订单id")
    private Long purchaseLedgerId;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("'整单折扣额'")
    private BigDecimal totalDiscountAmount;
    @ApiModelProperty("'整单折扣率'")
    private BigDecimal totalDiscountRate;
    @ApiModelProperty("'成交金额'")
    private BigDecimal totalAmount;
    @ApiModelProperty("录入时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
src/main/java/com/ruoyi/purchase/service/PurchaseReturnOrdersService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.ruoyi.purchase.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
/**
 * <p>
 *  æœåŠ¡ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-06 11:44:38
 */
public interface PurchaseReturnOrdersService extends IService<PurchaseReturnOrders> {
    IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto);
}
src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.ruoyi.purchase.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.purchase.dto.PurchaseReturnOrderDto;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper;
import com.ruoyi.purchase.service.PurchaseReturnOrdersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.purchase.vo.PurchaseReturnOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * <p>
 *  æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-06 11:44:38
 */
@Service
public class PurchaseReturnOrdersServiceImpl extends ServiceImpl<PurchaseReturnOrdersMapper, PurchaseReturnOrders> implements PurchaseReturnOrdersService {
    @Autowired
    private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper;
    @Override
    public IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) {
        return purchaseReturnOrdersMapper.listPage(page, purchaseReturnOrderDto);
    }
}
src/main/java/com/ruoyi/purchase/vo/PurchaseReturnOrderVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.ruoyi.purchase.vo;
import com.ruoyi.purchase.pojo.PurchaseReturnOrders;
public class PurchaseReturnOrderVo extends PurchaseReturnOrders {
    //供应商名称
    private String supplierName;
    // é‡‡è´­åˆåŒå·
    private String purchaseContractNumber;
    //退料人姓名
    private String returnUserName;
     //制单人姓名
    private String createUserName;
}
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -135,4 +135,10 @@
        util.exportExcel(response, list, "发货信息");
    }
    @GetMapping("/getByCustomerName")
    @ApiOperation("通过客户名称查询")
    public AjaxResult getByCustomerName(String customerName) {
        return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName));
    }
}
src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
@@ -43,6 +43,7 @@
    private Boolean hasChildren = false;
    private List<SalesLedgerProduct> productData;
    private List<SalesLedgerProductDto> productDtoData;
    private List<String> tempFileIds;
    private List<CommonFile> SalesLedgerFiles;
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductDto.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -57,4 +58,11 @@
    private Integer approvalStatus;
    @ApiModelProperty(value = "未退货数")
    private BigDecimal unQuantity;
    @ApiModelProperty(value = "退货总数")
    private BigDecimal totalReturnNum;
}
src/main/java/com/ruoyi/sales/mapper/ShippingInfoMapper.java
@@ -3,7 +3,10 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.pojo.ShippingInfo;
import org.apache.ibatis.annotations.Param;
@@ -17,4 +20,9 @@
    IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req);
    List<ShippingInfo> listAll();
    List<SalesLedgerProductDto> getReturnManagementDtoById(@Param("shippingId")Long shippingId);
    List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
}
src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
@@ -3,8 +3,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.pojo.ShippingInfo;
import org.apache.ibatis.annotations.Param;
import java.io.IOException;
import java.util.List;
@@ -19,4 +22,8 @@
    boolean deductStock(ShippingInfoDto req) throws IOException;
    boolean delete(List<Long> ids);
    List<SalesLedgerProductDto> getReturnManagementDtoById( Long shippingId);
    List<ShippingInfo> getShippingInfoByCustomerName(String customerName);
}
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.other.service.impl.TempFileServiceImpl;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
@@ -107,4 +108,15 @@
        return this.removeBatchByIds(ids);
    }
    @Override
    public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) {
        return shippingInfoMapper.getReturnManagementDtoById(shippingId );
    }
    @Override
    public List<ShippingInfo> getShippingInfoByCustomerName(String customerName) {
        return shippingInfoMapper.getShippingInfoByCustomerName(customerName);
    }
}
src/main/java/com/ruoyi/staff/controller/PersonalShiftController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.ruoyi.staff.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.staff.dto.PerformanceShiftAddDto;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
import com.ruoyi.staff.pojo.PersonalShift;
import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService;
import com.ruoyi.staff.service.PersonalShiftService;
import com.ruoyi.staff.utils.StyleMonthUtils;
import com.ruoyi.staff.utils.StyleYearUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 * <p>
 *  å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:52:19
 */
@RestController
@RequestMapping("/personalShift")
@Api(tags = "人员排班")
public class PersonalShiftController {
    @Autowired
    private PersonalShiftService personalShiftService;
    @ApiOperation("人员排班")
    @PostMapping("/add")
    public R add(@RequestBody PerformanceShiftAddDto performanceShiftAddDto){
        return R.ok(personalShiftService.performanceShiftAdd(performanceShiftAddDto));
    }
    @ApiOperation(value = "月份分页查询")
    @GetMapping("page")
    public R performanceShiftPage(Integer size, Integer current, String time, String userName, Integer sysDeptId) {
        return R.ok(personalShiftService.performanceShiftPage(new Page<>(current, size), time, userName, sysDeptId));
    }
    @ApiOperation(value = "年份分页查询")
    @GetMapping("pageYear")
    public R performanceShiftPageYear(Integer size, Integer current, String time, String userName, Integer sysDeptId) {
        return R.ok(personalShiftService.performanceShiftPageYear(new Page<>(current, size), time, userName, sysDeptId));
    }
    @ApiOperation(value = "班次状态修改")
    @PostMapping("update")
    public R performanceShiftUpdate(@RequestBody PersonalShift personalShift) {
        personalShiftService.performanceShiftUpdate(personalShift);
        return R.ok();
    }
    @ApiOperation(value = "导出")
    @GetMapping("export")
    public void exportToExcel(@NotNull(message = "时间不能为空!") String time, String userName, Integer sysDeptId, Boolean isMonth, HttpServletResponse response) throws Exception {
        Map<Object, Object> data;
        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        response.setHeader("requestType","excel");
        response.setHeader("Access-Control-Expose-Headers", "requestType");
        if (!isMonth) {
            data = personalShiftService.exportToYearExcel(time, userName, sysDeptId);
            // è®¾ç½®å•元格样式
            HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle());
            // ä¿å­˜åˆ°ç¬¬ä¸€ä¸ªsheet中
            EasyExcel.write(response.getOutputStream())
                    .head((List<List<String>>) data.get("header"))
                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // è‡ªé€‚应列宽
                    .registerWriteHandler(horizontalCellStyleStrategy)
                    .sheet("年度")
                    .doWrite((Collection<?>) data.get("data"));
        } else {
            data = personalShiftService.exportToMonthExcel(time, userName, sysDeptId);
            // è®¾ç½®å•元格样式
            HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleMonthUtils.getHeadStyle(), StyleMonthUtils.getContentStyle());
            EasyExcel.write(response.getOutputStream())
                    .head((List<List<String>>) data.get("header"))
                    .registerWriteHandler(horizontalCellStyleStrategy)
                    .sheet("月度")
                    .doWrite((Collection<?>) data.get("data"));
        }
    }
}
src/main/java/com/ruoyi/staff/dto/PerformanceShiftAddDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package com.ruoyi.staff.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Data
public class PerformanceShiftAddDto {
    @NotNull(message = "请选择班次")
    @ApiModelProperty("班次")
    private Integer personalAttendanceLocationConfigId;
    @NotNull(message = "请选择员工")
    @ApiModelProperty("员工id")
    private String staffOnJobId;
    @NotNull(message = "请选择周次")
    @ApiModelProperty("开始周次")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startWeek;
    @NotNull(message = "请选择周次")
    @ApiModelProperty("结束周次")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endWeek;
}
src/main/java/com/ruoyi/staff/dto/PerformanceShiftMapDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.staff.dto;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
public class PerformanceShiftMapDto {
    private String name;
    private String shiftTime;
    private String userId;
    private String department;
    private Map<String, Object> monthlyAttendance = new HashMap<>();
    private List<Map<String, Object>> list = new ArrayList<>();
    private List<Map<Object, Object>> headerList = new ArrayList<>();
}
src/main/java/com/ruoyi/staff/dto/PersonalAttendanceRecordsDto.java
@@ -40,4 +40,7 @@
    @JsonFormat(pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    private LocalTime  endAt;
    //班次
    private String shift;
}
src/main/java/com/ruoyi/staff/mapper/PersonalShiftMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.ruoyi.staff.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.config.MyBaseMapper;
import com.ruoyi.staff.dto.PerformanceShiftMapDto;
import com.ruoyi.staff.pojo.PersonalShift;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * <p>
 *  Mapper æŽ¥å£
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:52:19
 */
@Mapper
public interface PersonalShiftMapper extends BaseMapper<PersonalShift> {
    IPage<PerformanceShiftMapDto> performanceShiftPage(Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId);
    IPage<Map<String, Object>> performanceShiftYear(Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId);
    List<Map<String, Object>> performanceShiftYearList(@Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId);
    List<PerformanceShiftMapDto> performanceShiftList(@Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId);
}
src/main/java/com/ruoyi/staff/pojo/PersonalAttendanceLocationConfig.java
@@ -57,4 +57,7 @@
    @JsonFormat(pattern = "HH:mm")
    @DateTimeFormat(pattern = "HH:mm")
    private LocalTime  endAt;
    @ApiModelProperty("班次")
    private String shift;
}
src/main/java/com/ruoyi/staff/pojo/PersonalShift.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.ruoyi.staff.pojo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
/**
 * <p>
 *
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:52:19
 */
@Getter
@Setter
@TableName("personal_shift")
@ApiModel(value = "PersonalShift对象", description = "")
public class PersonalShift implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("班次(打卡规则id)")
    private Integer personalAttendanceLocationConfigId;
    @ApiModelProperty("员工在职id")
    private Long staffOnJobId;
    @ApiModelProperty("录入时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty("排班日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime workTime;
}
src/main/java/com/ruoyi/staff/service/PersonalShiftService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.ruoyi.staff.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.staff.dto.PerformanceShiftAddDto;
import com.ruoyi.staff.pojo.PersonalShift;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
 * <p>
 *  æœåŠ¡ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:52:19
 */
public interface PersonalShiftService extends IService<PersonalShift> {
    int performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto);
    Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, Integer sysDeptId);
    void performanceShiftUpdate(PersonalShift performanceShift);
    IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, Integer sysDeptId);
    Map<Object, Object> exportToYearExcel(String time, String userName, Integer sysDeptId) throws Exception;
    Map<Object, Object> exportToMonthExcel(String time, String userName, Integer sysDeptId);
}
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.staff.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -14,10 +15,12 @@
import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto;
import com.ruoyi.staff.dto.StaffOnJobDto;
import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper;
import com.ruoyi.staff.mapper.PersonalShiftMapper;
import com.ruoyi.staff.mapper.StaffOnJobMapper;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
import com.ruoyi.staff.pojo.PersonalAttendanceRecords;
import com.ruoyi.staff.mapper.PersonalAttendanceRecordsMapper;
import com.ruoyi.staff.pojo.PersonalShift;
import com.ruoyi.staff.pojo.StaffOnJob;
import com.ruoyi.staff.service.PersonalAttendanceRecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -63,6 +66,9 @@
    @Autowired
    private SysDeptMapper sysDeptMapper;
    @Autowired
    private PersonalShiftMapper personalShiftMapper;
    @Override
    public int add(PersonalAttendanceRecordsDto personalAttendanceRecordsDto) {
        // å½“前时间
@@ -76,20 +82,24 @@
        if (staffOnJob == null) {
            throw new BaseException("当前用户没有对应的员工信息");
        }
        /*判断打卡位置是否在规则范围内*/
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(Wrappers.<PersonalAttendanceLocationConfig>lambdaQuery()
                .eq(PersonalAttendanceLocationConfig::getSysDeptId, staffOnJob.getSysDeptId())
                .orderByDesc(PersonalAttendanceLocationConfig::getId));
        if (personalAttendanceLocationConfigs == null || personalAttendanceLocationConfigs.isEmpty()) {
            throw new BaseException("当前部门没有设置打卡规则");
        //判断判断员工当天是否有排班数据
        List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery()
                .eq(PersonalShift::getStaffOnJobId, staffOnJob.getId())
                .eq(PersonalShift::getWorkTime, currentDate.atStartOfDay())
                .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId));
        if (CollectionUtil.isEmpty(personalShifts)){
            throw new BaseException("当前用户当天没有排班数据");
        }
        /*判断打卡位置是否在规则范围内*/
        PersonalShift personalShift = personalShifts.get(0);
        PersonalAttendanceLocationConfig locationConfig = personalAttendanceLocationConfigMapper.selectById(personalShift.getPersonalAttendanceLocationConfigId());
        Double punchLongitude = personalAttendanceRecordsDto.getLongitude(); //打卡的经度
        Double punchLatitude = personalAttendanceRecordsDto.getLatitude(); // æ‰“卡的纬度
        if (punchLongitude == null || punchLatitude == null) {
            throw new BaseException("打卡失败:未获取到您的位置信息,请开启定位权限");
        }
        //计算打卡位置与考勤点的距离
        PersonalAttendanceLocationConfig locationConfig = personalAttendanceLocationConfigs.get(0);//获取最新的一条数据
        double allowedRadius = locationConfig.getRadius(); // å…è®¸çš„范围(米)
        double actualDistance = LocationUtils.calculateDistance(
                punchLatitude, punchLongitude, // å‘˜å·¥æ‰“卡的经纬度
@@ -231,12 +241,15 @@
        SysDept dept = sysDeptMapper.selectDeptById(staffOnJob.getSysDeptId());
        resultDto.setDeptName(dept != null ? dept.getDeptName() : null);
        //获取该员工对应的打卡规则
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(Wrappers.<PersonalAttendanceLocationConfig>lambdaQuery()
                .eq(PersonalAttendanceLocationConfig::getSysDeptId, staffOnJob.getSysDeptId())
                .orderByDesc(PersonalAttendanceLocationConfig::getId));
        if (personalAttendanceLocationConfigs.size()>0){
            resultDto.setStartAt(personalAttendanceLocationConfigs.get(0).getStartAt());
            resultDto.setEndAt(personalAttendanceLocationConfigs.get(0).getEndAt());
        List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery()
                .eq(PersonalShift::getStaffOnJobId, staffOnJob.getId())
                .eq(PersonalShift::getWorkTime, currentDate.atStartOfDay())
                .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId));
        if (CollectionUtil.isNotEmpty(personalShifts)){
            PersonalAttendanceLocationConfig personalAttendanceLocationConfig = personalAttendanceLocationConfigMapper.selectById(personalShifts.get(0).getPersonalAttendanceLocationConfigId());
            resultDto.setStartAt(personalAttendanceLocationConfig.getStartAt());
            resultDto.setEndAt(personalAttendanceLocationConfig.getEndAt());
            resultDto.setShift(personalAttendanceLocationConfig.getShift());
        }
        return resultDto;
    }
src/main/java/com/ruoyi/staff/service/impl/PersonalShiftServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,488 @@
package com.ruoyi.staff.service.impl;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.staff.dto.PerformanceShiftAddDto;
import com.ruoyi.staff.dto.PerformanceShiftMapDto;
import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
import com.ruoyi.staff.pojo.PersonalShift;
import com.ruoyi.staff.mapper.PersonalShiftMapper;
import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService;
import com.ruoyi.staff.service.PersonalShiftService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.staff.utils.JackSonUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.date.DateUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
 * <p>
 *  æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author èŠ¯å¯¼è½¯ä»¶ï¼ˆæ±Ÿè‹ï¼‰æœ‰é™å…¬å¸
 * @since 2026-03-05 03:52:19
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class PersonalShiftServiceImpl extends ServiceImpl<PersonalShiftMapper, PersonalShift> implements PersonalShiftService {
    @Autowired
    private PersonalAttendanceLocationConfigMapper personalAttendanceLocationConfigMapper;
    @Override
    public int performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) {
        List<PersonalShift> list = new ArrayList<>();
        LocalDateTime startWeek = performanceShiftAddDto.getStartWeek();//开始日期
        LocalDateTime endWeek = performanceShiftAddDto.getEndWeek();//结束日期
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        String formattedDateTime = performanceShiftAddDto.getStartWeek().format(formatter);
        String[] splitUserId = performanceShiftAddDto.getStaffOnJobId().split(",");
        for (String userId : splitUserId) {
            //判断是否跨月
            boolean isMonth = startWeek.getMonthValue() != endWeek.getMonthValue();
            if (isMonth){
                //如果跨月,则两个月都判断一下看数据库是哪个月份的数据没有
                boolean exists1 = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery()
                        .eq(PersonalShift::getWorkTime, startWeek)
                        .eq(PersonalShift::getStaffOnJobId, userId));
                boolean exists2 = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery()
                        .eq(PersonalShift::getWorkTime, endWeek)
                        .eq(PersonalShift::getStaffOnJobId, userId));
                if (!exists1 && !exists2){
                    //两个月都不存在数据
                    list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list);
                    list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list);
                }else if (!exists1 && exists2){
                    //开始的月份不存在数据
                    list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list);
                }else if (exists1 && !exists2){
                    //结束的月份不存在数据
                    list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list);
                }
            }else {
                //不跨月
                boolean exists = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery()
                        .in(PersonalShift::getWorkTime, formattedDateTime)
                        .eq(PersonalShift::getStaffOnJobId, userId));
                // å¦‚果不存在添加数据
                if (!exists) {
                    list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list);
                }
            }
        }
        if (!list.isEmpty()) {
           saveBatch(list);
            list.clear();
        }
        // å†æ¬¡æ›´æ–°
        List<LocalDateTime> datesBetween = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek());
        for (LocalDateTime date : datesBetween) {
            for (String s : splitUserId) {
                PersonalShift personalShift = new PersonalShift();
                personalShift.setPersonalAttendanceLocationConfigId(performanceShiftAddDto.getPersonalAttendanceLocationConfigId());
                personalShift.setStaffOnJobId(Long.valueOf(s));
                personalShift.setWorkTime(date);
                String formatterDateTime = date.format(formatter);
                baseMapper.update(new PersonalShift(), Wrappers.<PersonalShift>lambdaUpdate()
                        .set(PersonalShift::getPersonalAttendanceLocationConfigId, performanceShiftAddDto.getPersonalAttendanceLocationConfigId())
                        .eq(PersonalShift::getStaffOnJobId, s)
                        .eq(PersonalShift::getWorkTime, formatterDateTime));
            }
        }
        return 0;
    }
    @Override
    public Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, Integer sysDeptId) {
        IPage<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftPage(page, time, userName, sysDeptId);
        //查询所有班次(打卡规则)
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null);
        mapIPage.getRecords().forEach(i -> {
            String[] shiftTimes = i.getShiftTime().split(";");
            double totalAttendance = 0;//总出勤天数
            List<Map<String, Object>> map = new ArrayList<>();
            // åˆ†å‰²æ—¥æœŸ
            for (String shiftTime : shiftTimes) {
                i.setShiftTime(null);
                Map<String, Object> hashMap = new HashMap<>();
                String[] shiftTimeAndShift = shiftTime.split(":");
                //排班详细数据
                hashMap.put("id", shiftTimeAndShift[2]);
                hashMap.put("shift", shiftTimeAndShift[1]);
                hashMap.put("time", shiftTimeAndShift[0]);
                map.add(hashMap);
                i.setList(map);
                //汇总的各班次统计数据
                for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                    if (!i.getMonthlyAttendance().containsKey(personalAttendanceLocationConfig.getShift())){
                        i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), 0);
                    }
                    if (personalAttendanceLocationConfig.getShift().equals(shiftTimeAndShift[1])) {
                        BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(personalAttendanceLocationConfig.getShift()).toString());
                        i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), bigDecimal.add(new BigDecimal("1")));
                    }
                }
                //统计总出勤天数(早/中/晚/夜)都算出勤,其余都是休息
                if (shiftTimeAndShift[1].contains("早") ||
                        shiftTimeAndShift[1].contains("中") ||
                        shiftTimeAndShift[1].contains("晚") ||
                        shiftTimeAndShift[1].contains("夜")) {
                    i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1);
                }
            }
        });
        // èŽ·å–header时间
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        // å°†å­—符串时间转换为 LocalDateTime ç±»åž‹æ—¶é—´
        LocalDateTime localDateTime = LocalDateTime.parse(time, formatters);
        LocalDate firstDayOfMonth = localDateTime.toLocalDate().withDayOfMonth(1);
        LocalDate lastDayOfMonth = localDateTime.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
        List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
        List<Object> list1 = new ArrayList<>();
        for (LocalDateTime dateTime : localDateTimesBetween) {
            Map<Object, Object> hashMap = new HashMap<>();
            DateTime parse = DateUtil.parse(dateTime.format(formatter));
            hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1)));
            hashMap.put("headerTime", getWeek(dateTime.format(formatters)));
            list1.add(hashMap);
        }
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("page", mapIPage);
        resultMap.put("headerList", list1);
        return resultMap;
    }
    @Override
    public void performanceShiftUpdate(PersonalShift personalShift) {
        baseMapper.update(new PersonalShift(), Wrappers.<PersonalShift>lambdaUpdate()
                .eq(PersonalShift::getId, personalShift.getId())
                .set(PersonalShift::getPersonalAttendanceLocationConfigId, personalShift.getPersonalAttendanceLocationConfigId()));
    }
    @Override
    public IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, Integer sysDeptId) {
        IPage<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYear(page, time, userName, sysDeptId);
        //查询所有班次(打卡规则)
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null);
        mapYearIPage.setRecords(annualAttendanceProcessing(mapYearIPage.getRecords(), personalAttendanceLocationConfigs));
        return mapYearIPage;
    }
    @Override
    public Map<Object, Object> exportToYearExcel(String time, String userName, Integer sysDeptId) throws Exception {
        Map<Object, Object> map = new HashMap<>();
        //查询所有班次(打卡规则)
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null);
        DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        // å°†å­—符串时间转换为 LocalDateTime ç±»åž‹æ—¶é—´
        LocalDateTime localDateTime = LocalDateTime.parse(time, formatters);
        map.put("header", getYearHeader(localDateTime.getYear() + " å¹´", personalAttendanceLocationConfigs));
        List<Map<String, Object>> mapYearList = baseMapper.performanceShiftYearList(time, userName, sysDeptId);
        annualAttendanceProcessing(mapYearList, personalAttendanceLocationConfigs);
        List<List<Object>> lists = dataRequiredForProcessingIntoExcel(mapYearList, personalAttendanceLocationConfigs);
        map.put("data", lists);
        return map;
    }
    @Override
    public Map<Object, Object> exportToMonthExcel(String time, String userName, Integer sysDeptId) {
        //查询所有班次(打卡规则)
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null);
        List<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftList(time, userName, sysDeptId);
        mapIPage.forEach(i -> {
            String[] shiftTimes = i.getShiftTime().split(";");
            double totalAttendance = 0;
            List<Map<String, Object>> map = new ArrayList<>();
            // åˆ†å‰²æ—¥æœŸ
            for (String shiftTime : shiftTimes) {
                Map<String, Object> hashMap = new HashMap<>();
                String[] shiftTimeAndShift = shiftTime.split(":");
                for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                    if (!i.getMonthlyAttendance().containsKey(personalAttendanceLocationConfig.getShift())) {
                        i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), 0);
                    }
                    if (personalAttendanceLocationConfig.getShift().equals(shiftTimeAndShift[1])) {
                        BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(personalAttendanceLocationConfig.getShift()).toString());
                        i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), bigDecimal.add(new BigDecimal("1")));
                    }
                }
                //统计总出勤天数(早/中/晚/夜)都算出勤,其余都是休息
                if (shiftTimeAndShift[1].contains("早") ||
                        shiftTimeAndShift[1].contains("中") ||
                        shiftTimeAndShift[1].contains("晚") ||
                        shiftTimeAndShift[1].contains("夜")) {
                    i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1);
                }
                hashMap.put("id", shiftTimeAndShift[2]);
                hashMap.put("shift", shiftTimeAndShift[1]);
                hashMap.put("time", shiftTimeAndShift[0]);
                map.add(hashMap);
            }
            i.setList(map);
            i.setShiftTime(null);
        });
        Map<Object, Object> map = new HashMap<>();
        DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        // å°†å­—符串时间转换为 LocalDateTime ç±»åž‹æ—¶é—´
        LocalDateTime localDateTime = LocalDateTime.parse(time, formatters);
        map.put("header", getMonthHeader(localDateTime));
        List<List<Object>> lists = dataRequiredForProcessingIntoExcelMonth(mapIPage, personalAttendanceLocationConfigs);
        map.put("data", lists);
        return map;
    }
    // å¹´åˆ†é¡µä¸Žå¯¼å‡ºå…±åŒä½¿ç”¨
    public List<Map<String, Object>> annualAttendanceProcessing(List<Map<String, Object>> mapYearList,List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) {
        for (Map<String, Object> map : mapYearList) {
            Map<String, Object> resultMap = new LinkedHashMap<>();
            Map<String, Object> hashMapYear = new LinkedHashMap<>();
            double totalYearAttendance = 0;
            // ä¸€å¹´12个月
            for (int i = 1; i < 13; i++) {
                Map<String, Object> hashMapMonth = new LinkedHashMap<>();
                double totalMonthAttendance = 0;
                for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                    // åˆå§‹åŒ–赋值
                    if (!hashMapYear.containsKey(personalAttendanceLocationConfig.getShift())){
                        hashMapYear.put(personalAttendanceLocationConfig.getShift(), 0);
                    }
                    // æœˆ
                    if (!ObjectUtils.isEmpty(map.get("month_str"))) {
                        String charArray = map.get("month_str").toString();
                        int count = countOccurrences(charArray, i + ":" + personalAttendanceLocationConfig.getShift());
                        hashMapMonth.put(personalAttendanceLocationConfig.getShift(), count);
                        hashMapYear.put(personalAttendanceLocationConfig.getShift(), new BigDecimal(hashMapYear.get(personalAttendanceLocationConfig.getShift()).toString()).add(new BigDecimal(count)));
                        // æ—©ï¼Œä¸­ï¼Œå¤œï¼Œå·®
                        if (personalAttendanceLocationConfig.getShift().contains("早") ||
                                personalAttendanceLocationConfig.getShift().contains("中") ||
                                personalAttendanceLocationConfig.getShift().contains("晚") ||
                                personalAttendanceLocationConfig.getShift().contains("夜")) {
                            totalMonthAttendance += count;
                            totalYearAttendance += count;
                        }
                    }
                    // ç©ºæ•°æ®
                    else {
                        map.put("work_time", i);
                        hashMapMonth.put(personalAttendanceLocationConfig.getShift(), 0);
                    }
                }
                hashMapMonth.put("totalMonthAttendance", totalMonthAttendance);
                hashMapYear.put("totalYearAttendance", totalYearAttendance);
                resultMap.put(i + "", hashMapMonth);
            }
            map.remove("month_str");
            map.remove("year_str");
            map.put("year", hashMapYear);
            map.put("month", resultMap);
        }
        return mapYearList;
    }
    public static int countOccurrences(String str, String target) {
        int count = 0;
        int index = 0;
        while ((index = str.indexOf(target, index)) != -1) {
            count++;
            index += target.length();
        }
        return count;
    }
    public List<List<Object>> dataRequiredForProcessingIntoExcel(List<Map<String, Object>> list, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) throws Exception {
        List<List<Object>> data = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            List<Object> excelRowList = new ArrayList<>();
            excelRowList.add(i + 1);
            excelRowList.add(list.get(i).get("account"));
            excelRowList.add(list.get(i).get("name"));
            Map<String, Object> year = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("year")), Map.class);
            excelRowList.add(year.get("totalYearAttendance"));
            personalAttendanceLocationConfigs.forEach(j -> {
                excelRowList.add(year.get(j.getShift()));
            });
            Map<String, Map<String, Object>> month = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("month")), Map.class);
            for (int j = 1; j < 13; j++) {
                Object totalMonthAttendance = month.get(j + "").get("totalMonthAttendance");
                excelRowList.add(totalMonthAttendance);
                for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                        excelRowList.add(month.get(j + "").get(personalAttendanceLocationConfig.getShift()));
                }
            }
            data.add(excelRowList);
        }
        return data;
    }
    private List<PersonalShift>   saveMonth (LocalDateTime week,String userId,List<PersonalShift> list){
        LocalDate firstDayOfMonth = week.toLocalDate().withDayOfMonth(1);
        LocalDate lastDayOfMonth = week.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
        List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
        localDateTimesBetween.forEach(i -> {
            PersonalShift personalShift = new PersonalShift();
            personalShift.setStaffOnJobId(Long.valueOf(userId));
            personalShift.setWorkTime(i);
            list.add(personalShift);
            if (list.size() >= 1000) {
                saveBatch(list);
                list.clear();
            }
        });
        return list;
    }
    // èŽ·å–ä¸¤ä¸ªlocalDateTime的每一天
    public static List<LocalDateTime> getLocalDateTimesBetween(LocalDateTime start, LocalDateTime end) {
        List<LocalDateTime> localDateTimes = new ArrayList<>();
        LocalDate currentDate = start.toLocalDate();
        LocalDateTime currentLocalDateTime = start;
        while (!currentDate.isAfter(end.toLocalDate())) {
            localDateTimes.add(currentLocalDateTime);
            currentLocalDateTime = currentLocalDateTime.plusDays(1);
            currentDate = currentDate.plusDays(1);
        }
        return localDateTimes;
    }
    public static String getWeek(String dayStr) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            Date date = sdf.parse(dayStr);
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
            int day = calendar.get(Calendar.DAY_OF_MONTH);
            return day + " " + getWeekDay(dayOfWeek);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public static String getWeekDay(int dayOfWeek) {
        switch (dayOfWeek) {
            case Calendar.MONDAY:
                return "周一";
            case Calendar.TUESDAY:
                return "周二";
            case Calendar.WEDNESDAY:
                return "周三";
            case Calendar.THURSDAY:
                return "周四";
            case Calendar.FRIDAY:
                return "周五";
            case Calendar.SATURDAY:
                return "周六";
            case Calendar.SUNDAY:
                return "周日";
            default:
                return "未知";
        }
    }
    /**
     * è¿”回表头
     * <p>
     * å¤–层List代表行内层 List代表列  ç›¸åŒçš„列数据会被主动合并
     * æž„造双列表头
     *
     * @return List<List < String>>
     */
    private static List<List<String>> getYearHeader(String year, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) {
        List<List<String>> line = new ArrayList<>();
        line.add(Arrays.asList("考勤汇总", "序号", "序号"));
        line.add(Arrays.asList("考勤汇总", "工号", "工号"));
        line.add(Arrays.asList("考勤汇总", "姓名", "姓名"));
        line.add(Arrays.asList("出勤详情", year, "出勤"));
        // å¹´ header
        for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                line.add(Arrays.asList("考勤汇总", year, personalAttendanceLocationConfig.getShift()));
        }
        // æœˆheader
        for (int i = 1; i < 13; i++) {
            line.add(Arrays.asList("出勤详情", i + " æœˆ", "出勤"));
            for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                line.add(Arrays.asList("出勤详情", i + " æœˆ", personalAttendanceLocationConfig.getShift()));
            }
        }
        return line;
    }
    private static List<List<String>> getMonthHeader(LocalDateTime localDateTimeYear) {
        String year = localDateTimeYear.getYear() + " å¹´äººå‘˜ç­æ¬¡";
        List<List<String>> line = new ArrayList<>();
        line.add(Arrays.asList(year, "序号", "序号", "序号"));
        line.add(Arrays.asList(year, "姓名", "姓名", "姓名"));
        line.add(Arrays.asList(year, "部门", "部门", "部门"));
        line.add(Arrays.asList(year, localDateTimeYear.getYear() + "", localDateTimeYear.getYear() + "", "出勤"));
        line.add(Arrays.asList(year, localDateTimeYear.getYear() + "", localDateTimeYear.getYear() + "","休"));
        line.add(Arrays.asList(year, "å¹´", "å¹´", "请假"));
        line.add(Arrays.asList(year, localDateTimeYear.getMonthValue() + "", localDateTimeYear.getMonthValue() + "", "早"));
        line.add(Arrays.asList(year, "月", "月", "中"));
        line.add(Arrays.asList(year, "", "", "夜"));
        line.add(Arrays.asList(year, "周次", "星期", "出差"));
        LocalDate firstDayOfMonth = localDateTimeYear.toLocalDate().withDayOfMonth(1);
        LocalDate lastDayOfMonth = localDateTimeYear.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
        List<LocalDateTime> timeList = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
        timeList.forEach(i -> {
            int dayOfYear = i.getDayOfMonth();
            Date from = Date.from(i.atZone(ZoneId.systemDefault()).toInstant());
            String weekDay = getWeekDay(i.getDayOfWeek().getValue());
            line.add(Arrays.asList(year, DateUtil.weekOfYear(DateUtil.offsetDay(from, 1)) + "", weekDay, dayOfYear + ""));
        });
        return line;
    }
    public List<List<Object>> dataRequiredForProcessingIntoExcelMonth(List<PerformanceShiftMapDto> list, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) {
        List<List<Object>> data = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            List<Object> excelRowList = new ArrayList<>();
            excelRowList.add(i + 1);
            excelRowList.add(list.get(i).getName());
            excelRowList.add(list.get(i).getDepartment());
            excelRowList.add(list.get(i).getMonthlyAttendance().get("totalAttendance"));
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%休%")); // ä¼‘
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%假%")); // å‡
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%早%")); // æ—©
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%中%")); // ä¸­
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%夜%")); // å¤œ
            excelRowList.add(list.get(i).getMonthlyAttendance().get("%å·®%")); // å·®
            for (Map<String, Object> o : list.get(i).getList()) {
                String enumLabel = "";
                for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) {
                    if (personalAttendanceLocationConfig.getShift().equals(o.get("shift"))) {
                        enumLabel = personalAttendanceLocationConfig.getShift();
                    }
                }
                excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel);
            }
            data.add(excelRowList);
        }
        return data;
    }
}
src/main/java/com/ruoyi/staff/task/PersonalAttendanceRecordsTask.java
@@ -1,9 +1,17 @@
package com.ruoyi.staff.task;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.staff.dto.PerformanceShiftAddDto;
import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper;
import com.ruoyi.staff.mapper.PersonalShiftMapper;
import com.ruoyi.staff.mapper.StaffOnJobMapper;
import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig;
import com.ruoyi.staff.pojo.PersonalAttendanceRecords;
import com.ruoyi.staff.pojo.StaffOnJob;
import com.ruoyi.staff.service.PersonalAttendanceRecordsService;
import com.ruoyi.staff.mapper.PersonalAttendanceRecordsMapper;
import com.ruoyi.staff.service.PersonalShiftService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -12,7 +20,14 @@
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.WeekFields;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * ä¸ªäººè€ƒå‹¤è®°å½•定时任务
@@ -29,6 +44,15 @@
    @Autowired
    private PersonalAttendanceRecordsService personalAttendanceRecordsService;
    @Autowired
    private PersonalAttendanceLocationConfigMapper personalAttendanceLocationConfigMapper;
    @Autowired
    private StaffOnJobMapper staffOnJobMapper;
    @Autowired
    private PersonalShiftService personalShiftService;
    /**
     * æ¯å¤©å‡Œæ™¨ç”Ÿæˆæ˜¨æ—¥çš„缺勤记录
@@ -73,4 +97,50 @@
            log.error("生成昨日缺勤记录任务执行失败:{}", e.getMessage(), e);
        }
    }
    /**
     * å®šæ—¶ä»»åŠ¡,每个月1号的00:00:00给下一个月排班
     * ç»™æ¯ä¸ªäººéƒ½è¿›è¡ŒæŽ’班(默认早班)
     */
    @Scheduled(cron = "0 10 0 1 * ?")
    private void timerCreateSchedule() {
        log.info("开始给每个人进行排班,默认早班======start");
        PerformanceShiftAddDto performanceShiftAddDto = new PerformanceShiftAddDto();
        //查询所有班次(打卡规则)
        List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null);
        if (CollectionUtil.isEmpty(personalAttendanceLocationConfigs)){
            return;
        }
        performanceShiftAddDto.setPersonalAttendanceLocationConfigId(personalAttendanceLocationConfigs.get(0).getId());
        //在职人员
        List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffState, 1));
        if (CollectionUtil.isEmpty(staffOnJobs)){
            return;
        }
        String userIds = staffOnJobs.stream().map(user -> user.getId().toString()).distinct().collect(Collectors.joining(","));
        performanceShiftAddDto.setStaffOnJobId(userIds);
        //周次--当月所有
        // èŽ·å–å½“å‰æ—¥æœŸ
        LocalDate today = LocalDate.now(ZoneId.of(ZoneId.SHORT_IDS.get("CTT"))).plusMonths(1);
        // èŽ·å–æœ¬æœˆçš„ç¬¬ä¸€å¤©å’Œæœ€åŽä¸€å¤©
        LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth());
        LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth());
        // èŽ·å–å‘¨å­—æ®µä¿¡æ¯ï¼ˆæ ¹æ®åŒºåŸŸè®¾ç½®ï¼‰
        WeekFields weekFields = WeekFields.of(Locale.getDefault());
        // èŽ·å–æœ¬æœˆç¬¬ä¸€å¤©çš„å‘¨ä¸€
        LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek()));
        // éåŽ†æœ¬æœˆæ‰€æœ‰å¤©æ•°ï¼Œæ‰¾å‡ºæ¯å‘¨çš„ç¬¬ä¸€å¤©å’Œæœ€åŽä¸€å¤©
        LocalDate endOfWeek;
        while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) {
            endOfWeek = startOfWeek.plusDays(6);
            LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT);
            LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT);
            log.info("Week starts on {} and ends on {}", startDateTime, endDateTime);
            performanceShiftAddDto.setStartWeek(startDateTime);
            performanceShiftAddDto.setEndWeek(endDateTime);
            personalShiftService.performanceShiftAdd(performanceShiftAddDto);
            startOfWeek = startOfWeek.plusWeeks(1);
        }
        log.info("排班结束======end");
    }
}
src/main/java/com/ruoyi/staff/utils/JackSonUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,133 @@
package com.ruoyi.staff.utils;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
 * JSON解析处理
 *
 * @author zss
 */
@Component
public class JackSonUtil {
    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
    private static final ObjectWriter OBJECT_WRITER = OBJECT_MAPPER.writerWithDefaultPrettyPrinter();
    public static void marshal(File file, Object value) throws Exception {
        try {
            OBJECT_WRITER.writeValue(file, value);
        } catch (JsonGenerationException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static void marshal(OutputStream os, Object value) throws Exception {
        try {
            OBJECT_WRITER.writeValue(os, value);
        } catch (JsonGenerationException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static String marshal(Object value) throws Exception {
        try {
            return OBJECT_WRITER.writeValueAsString(value);
        } catch (JsonGenerationException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static byte[] marshalBytes(Object value) throws Exception {
        try {
            return OBJECT_WRITER.writeValueAsBytes(value);
        } catch (JsonGenerationException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static <T> T unmarshal(File file, Class<T> valueType) throws Exception {
        try {
            return OBJECT_MAPPER.readValue(file, valueType);
        } catch (JsonParseException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static <T> T unmarshal(InputStream is, Class<T> valueType) throws Exception {
        try {
            return OBJECT_MAPPER.readValue(is, valueType);
        } catch (JsonParseException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    /**
     * å­—符串转对象
     * @param str
     * @param valueType
     * @return
     * @param <T>
     * @throws Exception
     */
    public static <T> T unmarshal(String str, Class<T> valueType) throws Exception {
        try {
            OBJECT_MAPPER.registerModule(new JavaTimeModule());
            return OBJECT_MAPPER.readValue(str, valueType);
        } catch (JsonParseException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
    public static <T> T unmarshal(byte[] bytes, Class<T> valueType) throws Exception {
        try {
            if (bytes == null) {
                bytes = new byte[0];
            }
            return OBJECT_MAPPER.readValue(bytes, 0, bytes.length, valueType);
        } catch (JsonParseException e) {
            throw new Exception(e);
        } catch (JsonMappingException e) {
            throw new Exception(e);
        } catch (IOException e) {
            throw new Exception(e);
        }
    }
}
src/main/java/com/ruoyi/staff/utils/StyleMonthUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package com.ruoyi.staff.utils;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
public class StyleMonthUtils {
    /**
     * æ ‡é¢˜æ ·å¼
     * @return
     */
    public static WriteCellStyle getHeadStyle(){
        // å¤´çš„ç­–ç•¥
        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
        // èƒŒæ™¯é¢œè‰²
//        headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
//        headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // å­—体
        WriteFont headWriteFont = new WriteFont();
        headWriteFont.setFontName("等线");//设置字体名字
        headWriteFont.setFontHeightInPoints((short)9);//设置字体大小
        headWriteFont.setBold(true);//字体加粗
        headWriteFont.setColor((short) 0);
        headWriteCellStyle.setWriteFont(headWriteFont); //在样式用应用设置的字体;
        // æ ·å¼
        headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        headWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
        headWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        headWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
        headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        headWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
        headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        headWriteCellStyle.setTopBorderColor((short) 0); //设置顶边框颜色;
        headWriteCellStyle.setWrapped(false);  //设置自动换行;
        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);//设置水平对齐的样式为居中对齐;
        headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);  //设置垂直对齐的样式为居中对齐;
        headWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
        return headWriteCellStyle;
    }
    /**
     * å†…容样式
     * @return
     */
    public static WriteCellStyle getContentStyle(){
        // å†…容的策略
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        // è¿™é‡Œéœ€è¦æŒ‡å®š FillPatternType ä¸ºFillPatternType.SOLID_FOREGROUND ä¸ç„¶æ— æ³•显示背景颜色.头默认了 FillPatternType所以可以不指定
//        contentWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
        contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // è®¾ç½®å­—体
        WriteFont contentWriteFont = new WriteFont();
        contentWriteFont.setFontHeightInPoints((short) 10);//设置字体大小
        contentWriteFont.setFontName("等线"); //设置字体名字
        contentWriteCellStyle.setWriteFont(contentWriteFont);//在样式用应用设置的字体;
        //设置样式;
        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        contentWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        contentWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边框颜色;
        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å±…中
        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åž‚直居中
        contentWriteCellStyle.setWrapped(false); //设置自动换行;
//        contentWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
        return contentWriteCellStyle;
    }
}
src/main/java/com/ruoyi/staff/utils/StyleYearUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,89 @@
package com.ruoyi.staff.utils;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
public class StyleYearUtils {
    /**
     * æ ‡é¢˜æ ·å¼
     *
     * @return
     */
    public static WriteCellStyle getHeadStyle() {
        // å¤´çš„ç­–ç•¥
        WriteCellStyle headWriteCellStyle = new WriteCellStyle();
        // èƒŒæ™¯é¢œè‰²
//        headWriteCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());
        headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // å­—体
        WriteFont headWriteFont = new WriteFont();
        headWriteFont.setFontName("仿宋");//设置字体名字
        headWriteFont.setFontHeightInPoints((short) 9);//设置字体大小
        headWriteFont.setBold(true);//字体加粗
        headWriteFont.setColor((short) 1);
        headWriteCellStyle.setWriteFont(headWriteFont); //在样式用应用设置的字体;
        // æ ·å¼
        headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        headWriteCellStyle.setBottomBorderColor((short) 1);//设置底边框颜色;
        headWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        headWriteCellStyle.setLeftBorderColor((short) 1);//设置左边框颜色;
        headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        headWriteCellStyle.setRightBorderColor((short) 1);//设置右边框颜色;
        headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        headWriteCellStyle.setTopBorderColor((short) 1); //设置顶边框颜色;
        headWriteCellStyle.setWrapped(false);  //设置自动换行;
        headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);//设置水平对齐的样式为居中对齐;
        headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);  //设置垂直对齐的样式为居中对齐;
        headWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
        return headWriteCellStyle;
    }
    /**
     * å†…容样式
     *
     * @return
     */
    public static WriteCellStyle getContentStyle() {
        // å†…容的策略
        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
        // è¿™é‡Œéœ€è¦æŒ‡å®š FillPatternType ä¸ºFillPatternType.SOLID_FOREGROUND ä¸ç„¶æ— æ³•显示背景颜色.头默认了 FillPatternType所以可以不指定
//        contentWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
        // è®¾ç½®å­—体
        WriteFont contentWriteFont = new WriteFont();
        contentWriteFont.setFontHeightInPoints((short) 9);//设置字体大小
        contentWriteFont.setFontName("仿宋"); //设置字体名字
        contentWriteCellStyle.setWriteFont(contentWriteFont);//在样式用应用设置的字体;
        //设置样式;
        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
        contentWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);  //设置左边框;
        contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
        contentWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
        contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边框颜色;
        contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å±…中
        contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åž‚直居中
        contentWriteCellStyle.setWrapped(false); //设置自动换行;
//        contentWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
        return contentWriteCellStyle;
    }
}
src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
@@ -20,7 +20,7 @@
            t2.tax_exclusive_total_price,
            t3.inbound_num as quantityStock
        from  purchase_ledger t1
        left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id
        left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id and slp.type = 2
        left join procurement_record_storage t3 on t2.id = t3.sales_ledger_product_id
        where t1.purchase_contract_number = #{req.purchaseContractNumber}
        <if test="req.id != null and req.id != ''">
src/main/resources/mapper/procurementrecord/ReturnManagementMapper.xml
@@ -2,15 +2,55 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.procurementrecord.mapper.ReturnManagementMapper">
    <select id="listPage" resultType="com.ruoyi.procurementrecord.pojo.ReturnManagement">
        select * from return_management
    <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto">
        select rm.*,
               c.customer_name,
               si.shipping_no,
               sl.project_name,
               sl.sales_contract_no,
               sl.salesman
        from return_management rm
                 left join shipping_info si on rm.shipping_id = si.id
                 left join customer c on rm.customer_id = c.id
                 left join sales_ledger sl on si.sales_ledger_id = sl.id
        <where>
            <if test="req.returnNo != null and req.returnNo != ''">
                and return_no like concat('%',#{req.returnNo},'%')
                and rm.return_no like concat('%',#{req.returnNo},'%')
            </if>
            <if test="req.returnType != null and req.returnType != ''">
                and return_type = #{req.returnType}
            <if test="req.customerName != null and req.customerName != ''">
                and c.customer_name like concat('%',#{req.customerName},'%')
            </if>
            <if test="req.projectName != null and req.projectName != ''">
                and sl.project_name like concat('%',#{req.projectName},'%')
            </if>
            <if test="req.salesman != null and req.salesman != ''">
                and sl.salesman like concat('%',#{req.salesman},'%')
            </if>
            <if test="req.shippingNo != null and req.shippingNo != ''">
                and rm.shipping_no like concat('%',#{req.shippingNo},'%')
            </if>
            <if test="req.projectStage != null and req.projectStage != ''">
                and rm.project_stage like concat('%',#{req.projectStage},'%')
            </if>
            <if test="req.maker != null and req.maker != ''">
                and rm.maker like concat('%',#{req.maker},'%')
            </if>
            <if test="req.salesContractNo != null and req.salesContractNo != ''">
                and sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
            </if>
        </where>
    </select>
    <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto">
     select rm.*,
               c.customer_name,
               si.shipping_no,
               sl.project_name,
               sl.sales_contract_no,
               sl.salesman
        from return_management rm
                 left join shipping_info si on rm.shipping_id = si.id
                 left join customer c on rm.customer_id = c.id
                 left join sales_ledger sl on si.sales_ledger_id = sl.id
        where rm.id = #{id}
    </select>
</mapper>
src/main/resources/mapper/procurementrecord/ReturnSaleProductMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.procurementrecord.pojo.ReturnSaleProduct">
        <id column="id" property="id" />
        <result column="return_management_id" property="returnManagementId" />
        <result column="return_sale_ledger_product_id" property="returnSaleLedgerProductId" />
        <result column="num" property="num" />
        <result column="status" property="status" />
    </resultMap>
    <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto">
        SELECT slp.product_category                                         as product_name,
               slp.specification_model                                      as model,
               rsp.*,
               GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity,
               COALESCE(rs.total_return_num, 0)                             AS total_return_num
        FROM return_sale_product rsp
                 LEFT JOIN return_management rm ON rm.id = rsp.return_management_id
                 LEFT JOIN shipping_info si ON si.id = rm.shipping_id
                 LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1
                 LEFT JOIN (SELECT return_sale_ledger_product_id,
                                   SUM(num) AS total_return_num
                            FROM return_sale_product
                            WHERE 1 = 1 and return_management_id != #{returnManagementId}
                            GROUP BY return_sale_ledger_product_id) rs ON rs.return_sale_ledger_product_id = slp.id
        where rm.id =#{returnManagementId}
    </select>
</mapper>
src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -41,7 +41,7 @@
        ) shipping_status_counts ON sl.id = shipping_status_counts.sales_ledger_id
            left join product_model pm on po.product_model_id = pm.id
            left join product p on pm.product_id = p.id
        left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id
        left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1
        left join product_process_route ppr on po.id = ppr.product_order_id
        left join product_bom pb on pb.id = ppr.bom_id
        <where>
src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -22,7 +22,7 @@
        FROM
        sales_ledger_production_accounting t4
        LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id
        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id
        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1
        <where>
            t3.type = 1
            <if test="salesLedgerDto.schedulingUserName != null and salesLedgerDto.schedulingUserName != '' ">
src/main/resources/mapper/production/SalesLedgerSchedulingMapper.xml
@@ -91,7 +91,7 @@
        FROM
        sales_ledger_scheduling T2
        LEFT JOIN sales_ledger T1 ON T1.id = T2.sales_ledger_id
        left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id
        left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id and slp.type = 1
        <where>
            t3.type = 1
            <if test="salesLedgerDto.status != null and salesLedgerDto.status != '' ">
src/main/resources/mapper/production/SalesLedgerWorkMapper.xml
@@ -28,7 +28,7 @@
        FROM
        sales_ledger_work t4
        LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id
        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id
        left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1
        left join sales_ledger_scheduling t2 on t4.sales_ledger_scheduling_id = t2.id
        <where>
            t3.type = 1
src/main/resources/mapper/projectManagement/PlanMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.projectManagement.mapper.PlanMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.projectManagement.pojo.Plan">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="description" column="description" jdbcType="VARCHAR"/>
            <result property="attachment" column="attachment" jdbcType="VARCHAR"/>
            <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,name,description,
        attachment,is_delete,create_time,
        update_time,create_user,update_user
    </sql>
    <select id="selectPlanPage" resultMap="BaseResultMap">
        select t1.*
        from project_management_plan as t1
            where t1.is_delete = 0
        order by t1.create_time desc
    </select>
</mapper>
src/main/resources/mapper/projectManagement/PlanNodeMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.projectManagement.mapper.PlanNodeMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.projectManagement.pojo.PlanNode">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="projectManagementPlanId" column="project_management_plan_id" jdbcType="BIGINT"/>
            <result property="sort" column="sort" jdbcType="INTEGER"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="leaderId" column="leader_id" jdbcType="BIGINT"/>
            <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/>
            <result property="estimatedDuration" column="estimated_duration" jdbcType="INTEGER"/>
            <result property="hourlyRate" column="hourly_rate" jdbcType="VARCHAR"/>
            <result property="workContent" column="work_content" jdbcType="VARCHAR"/>
            <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
            <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,project_management_plan_id,sort,
        name,leader_id,leader_name,
        estimated_duration,hourly_rate,work_content,
        is_delete,create_time,update_time,
        create_user,update_user
    </sql>
</mapper>
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.purchase.pojo.PurchaseReturnOrders">
        <id column="id" property="id" />
        <result column="no" property="no" />
        <result column="return_type" property="returnType" />
        <result column="supplier_id" property="supplierId" />
        <result column="project_id" property="projectId" />
        <result column="project_phase" property="projectPhase" />
        <result column="prepared_at" property="preparedAt" />
        <result column="prepared_user_id" property="preparedUserId" />
        <result column="return_user_id" property="returnUserId" />
        <result column="purchase_ledger_id" property="purchaseLedgerId" />
        <result column="remark" property="remark" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
    <select id="listPage" resultType="com.ruoyi.purchase.vo.PurchaseReturnOrderVo">
        SELECT
        pro.*,
        sm.supplier_name as supplierName,
        pl.purchase_contract_number as purchaseContractNumber,
        su.user_name as returnUserName,
        su1.user_name as createUserName
        FROM purchase_return_orders pro
        LEFT JOIN supplier_manage sm ON pro.supplier_id = sm.id
        LEFT JOIN purchase_ledger pl ON pl.id = pro.purchase_ledger_id
        LEFT JOIN sys_user su ON su.user_id = pro.return_user_id
        LEFT JOIN sys_user su1 ON su1.user_id = pro.prepared_user_id
        where 1=1
        <if test="params.no != null and params.no != '' ">
            AND pro.no LIKE CONCAT('%',#{params.no},'%')
        </if>
    </select>
</mapper>
src/main/resources/mapper/sales/ReceiptPaymentMapper.xml
@@ -90,7 +90,7 @@
        FROM invoice_ledger_file
        GROUP BY invoice_ledger_id
        ) T4 ON T4.invoice_ledger_id = T1.id
        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id
        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
        LEFT JOIN (
        SELECT
        SUM(receipt_payment_amount) AS receipt_payment_amount_total,
@@ -378,7 +378,7 @@
                GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
            FROM invoice_ledger_file GROUP BY invoice_ledger_id
        ) T4 ON T4.invoice_ledger_id = T1.id
                 LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id
                 LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
                 LEFT JOIN (
            SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
                BY invoice_ledger_id
@@ -414,7 +414,7 @@
        GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName
        FROM invoice_ledger_file GROUP BY invoice_ledger_id
        ) T4 ON T4.invoice_ledger_id = T1.id
        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id
        LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1
        LEFT JOIN (
        SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP
        BY invoice_ledger_id
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -31,7 +31,7 @@
                 left join production_product_main ppm on qi.product_main_id = ppm.id
                 left join product_work_order pwo on ppm.work_order_id = pwo.id
                 left join product_order po on pwo.product_order_id = po.id
                 left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id
                 left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1
        where qi.product_main_id = #{productMainId}
@@ -144,7 +144,7 @@
                     p.product_name,
                     ps.unit_quantity * slp.quantity AS single_quantity
              FROM sales_ledger sl
                       LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id
                       LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id and slp.type = 1
                       LEFT JOIN product_model pm ON pm.id = slp.product_model_id
                       LEFT JOIN product_bom pb ON pb.product_model_id = pm.id
                       LEFT JOIN product_structure ps ON pb.id = ps.bom_id
src/main/resources/mapper/sales/ShipmentApprovalMapper.xml
@@ -9,7 +9,7 @@
        FROM shipment_approval sa
                 LEFT JOIN shipping_info si ON sa.shipping_info_id = si.id
                 LEFT JOIN sales_ledger sl ON sa.sales_ledger_id = sl.id
                 LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id
                 LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id and slp.type = 1
                 LEFT JOIN sys_user T2 ON sl.entry_person = T2.user_id
        <where>
            1=1
src/main/resources/mapper/sales/ShippingInfoMapper.xml
@@ -24,7 +24,7 @@
        sl.customer_name
        FROM shipping_info s
        LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
        LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id
        LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1
        left join product_model pm on slp.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        WHERE 1=1
@@ -58,4 +58,32 @@
        FROM shipping_info s
                 LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
    </select>
    <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto">
        SELECT
        slp.*,
        GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity,
        COALESCE(rs.total_return_num, 0) AS total_return_num
        FROM shipping_info si
        LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1
        LEFT JOIN (
        SELECT
        return_sale_ledger_product_id,
        SUM(num) AS total_return_num
        FROM return_sale_product rsp
        left join return_management rm on rm.id = rsp.return_management_id
        left join shipping_info si on si.id = rm.shipping_id
        WHERE 1=1
        GROUP BY return_sale_ledger_product_id
        ) rs ON rs.return_sale_ledger_product_id = slp.id
        <where>
            <if test="shippingId != null">
                si.id = #{shippingId}
            </if>
        </where>
    </select>
    <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo">
        select * from shipping_info si
        left join sales_ledger sl on si.sales_ledger_id = sl.id
        where sl.customer_name = #{customerName}
    </select>
</mapper>
src/main/resources/mapper/staff/PersonalShiftMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.staff.mapper.PersonalShiftMapper">
    <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.staff.pojo.PersonalShift">
        <id column="id" property="id" />
        <result column="personal_attendance_location_config_id" property="personalAttendanceLocationConfigId" />
        <result column="staff_on_job_id" property="staffOnJobId" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="work_time" property="workTime" />
    </resultMap>
    <select id="performanceShiftPage" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto">
         SELECT
        u.staff_name name,
        GROUP_CONCAT(s.work_time, ':', IFNULL(palc.shift, ''), ':', s.id order by s.work_time SEPARATOR ';') AS shift_time,
                u.id user_id
        FROM personal_shift s
        LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
        LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
        <where>
             <if test="sysDeptId != null and sysDeptId != ''">
                and u.sys_dept_id = #{sysDeptId}
            </if>
            <if test="time != null and time != ''">
                and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
            </if>
            <if test="userName != null and userName != ''">
                and u.staff_name like concat('%', #{userName}, '%')
            </if>
        </where>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftYear" resultType="java.util.Map">
         SELECT
         u.staff_name name,
         u.id user_id,
         u.staff_no account,
        DATE_FORMAT(s.work_time, '%c') work_time,
        GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
        FROM personal_shift s
        LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
         LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
         <where>
            <if test="time != null and time != ''">
                and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
            </if>
            <if test="userName != null and userName != ''">
                and u.staff_name like concat('%', #{userName}, '%')
            </if>
             <if test="sysDeptId != null and sysDeptId != ''">
                and u.sys_dept_id = #{sysDeptId}
            </if>
          </where>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftYearList" resultType="java.util.Map">
         SELECT
        u.staff_name name,
        s.staff_on_job_id user_id, u.staff_no account,
        DATE_FORMAT(s.work_time, '%c') work_time,
        GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), ':', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str
        FROM personal_shift s
        LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
        LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
       <where>
        <if test="time != null and time != ''">
            and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' )
        </if>
        <if test="userName != null and userName != ''">
            and u.staff_name like concat('%', #{userName}, '%')
        </if>
       <if test="sysDeptId != null and sysDeptId != ''">
            and u.sys_dept_id = #{sysDeptId}
       </if>
          </where>
        GROUP BY u.id
        order by s.create_time
    </select>
    <select id="performanceShiftList" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto">
         SELECT
        u.staff_name name,
        GROUP_CONCAT(s.work_time, ':', IFNULL(palc.shift, ''), ':', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id
        FROM personal_shift s
        LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id
        LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id
        <where>
            <if test="time != null and time != ''">
                and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' )
            </if>
            <if test="userName != null and userName != ''">
                and u.staff_name like concat('%', #{userName}, '%')
            </if>
             <if test="sysDeptId != null and sysDeptId != ''">
                and u.sys_dept_id = #{sysDeptId}
            </if>
        </where>
        GROUP BY u.id
        order by s.create_time
    </select>
</mapper>