| 昨天 | gongchunyi | ![]() |
| 昨天 | huminmin | ![]() |
| 昨天 | huminmin | ![]() |
| 昨天 | zss | ![]() |
| 昨天 | zss | ![]() |
| 昨天 | gongchunyi | ![]() |
| 昨天 | zss | ![]() |
| 昨天 | huminmin | ![]() |
| 昨天 | gongchunyi | ![]() |
| 昨天 | zss | ![]() |
src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -25,8 +25,12 @@ import com.ruoyi.project.system.mapper.SysDeptMapper; import com.ruoyi.project.system.mapper.SysUserMapper; import com.ruoyi.project.system.service.ISysNoticeService; import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; import com.ruoyi.purchase.pojo.PurchaseLedger; import com.ruoyi.sales.mapper.CommonFileMapper; import com.ruoyi.sales.mapper.ShippingInfoMapper; import com.ruoyi.sales.pojo.CommonFile; import com.ruoyi.sales.pojo.ShippingInfo; import com.ruoyi.sales.service.impl.CommonFileServiceImpl; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; @@ -157,29 +161,61 @@ return sysDeptList; } @Autowired private PurchaseLedgerMapper purchaseLedgerMapper; @Autowired private ShippingInfoMapper shippingInfoMapper; @Override public IPage<ApproveProcess> listAll(Page page, ApproveProcess approveProcess) { IPage<ApproveProcess> approveProcessIPage = approveProcessMapper.listPage(page, approveProcess); List<ApproveProcess> records = approveProcessIPage.getRecords(); for (ApproveProcess record : records) { List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, record.getId()) .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue())); record.setCommonFileList(commonFiles); // 采购审批查询采购附件 if (approveProcess.getApproveType() == 5) { List<CommonFile> commonFiles1 = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, record.getId()) .eq(CommonFile::getType, FileNameType.PURCHASE.getValue())); record.setCommonFileList(commonFiles1); List<CommonFile> allFiles = new ArrayList<>(); // 采购审批查询 if (record.getApproveType() == 5) { String contractNo = record.getApproveReason(); PurchaseLedger ledger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() .eq(PurchaseLedger::getPurchaseContractNumber, contractNo) .last("limit 1")); if (ledger != null) { allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, ledger.getId()) .eq(CommonFile::getType, FileNameType.PURCHASE.getValue())); } } // 发货审批查询发货附件 if (approveProcess.getApproveType() == 7) { List<CommonFile> commonFiles1 = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, record.getId()) .eq(CommonFile::getType, FileNameType.SHIP.getValue())); record.setCommonFileList(commonFiles1); // 发货审批查询 else if (record.getApproveType() == 7) { String reason = record.getApproveReason(); // 格式为 "xx:...-..." if (StringUtils.hasText(reason) && reason.contains(":")) { // 提取冒号后面的发货单号 String shippingNo = reason.split(":")[1]; // 根据发货单号查询发货台账记录 ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() .eq(ShippingInfo::getShippingNo, shippingNo) .last("limit 1")); if (shippingInfo != null) { // 使用发货台账的 销售台账ID 去查附件 allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, shippingInfo.getSalesLedgerId()) .eq(CommonFile::getType, FileNameType.SALE.getValue())); } } } // 查询审批单自身的附件 else { allFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() .eq(CommonFile::getCommonId, record.getId()) .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue())); } record.setCommonFileList(allFiles); } return approveProcessIPage; } src/main/java/com/ruoyi/customervisits/service/impl/CustomerVisitsServiceImpl.java
@@ -26,12 +26,19 @@ @Override public IPage<CustomerVisits> listPage(Page page, CustomerVisits customerVisits) { LambdaQueryWrapper<CustomerVisits> customerVisitsLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (customerVisits != null && !StringUtils.isEmpty(customerVisits.getCustomerName())) { customerVisitsLambdaQueryWrapper.like(CustomerVisits::getCustomerName, customerVisits.getCustomerName()); LambdaQueryWrapper<CustomerVisits> wrapper = new LambdaQueryWrapper<>(); if (customerVisits != null) { if (StringUtils.hasText(customerVisits.getCustomerName())) { wrapper.like(CustomerVisits::getCustomerName, customerVisits.getCustomerName()); } if (StringUtils.hasText(customerVisits.getVisitingPeople())) { wrapper.like(CustomerVisits::getVisitingPeople, customerVisits.getVisitingPeople()); } } Page page1 = customerVisitsMapper.selectPage(page, customerVisitsLambdaQueryWrapper); return page1; return customerVisitsMapper.selectPage(page, wrapper); } @Override src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java
@@ -80,37 +80,55 @@ @Override @Transactional(rollbackFor = Exception.class) public AjaxResult updateRecord(ProductRecordDto productRecordDto) { SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecordDto.getSaleLedgerProjectId()); ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId()); if (productRecord == null) return AjaxResult.error("记录不存在"); // 更新产品台账 SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId()); if (salesLedgerProduct != null) { salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount()).subtract(productRecordDto.getTicketsAmount())); salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum().subtract(productRecordDto.getTicketsNum()))); // 未来票金额 = 原未来票金额 + 旧行金额 - 新行金额 BigDecimal futureTicketsAmount = salesLedgerProduct.getFutureTicketsAmount() .add(productRecord.getTicketsAmount()) .subtract(productRecordDto.getTicketsAmount()); salesLedgerProduct.setFutureTicketsAmount(futureTicketsAmount); // 未来票数 = 原未来票数 + 旧行数量 - 新行数量 BigDecimal futureTickets = salesLedgerProduct.getFutureTickets() .add(productRecord.getTicketsNum()) .subtract(productRecordDto.getTicketsNum()); salesLedgerProduct.setFutureTickets(futureTickets); // 更新产品表本次数值 salesLedgerProduct.setTicketsAmount(productRecordDto.getTicketsAmount()); salesLedgerProduct.setTicketsNum(productRecordDto.getTicketsNum()); salesLedgerProductMapper.updateById(salesLedgerProduct); } PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(productRecord.getPurchaseLedgerId()); if (purchaseLedger != null) { purchaseLedger.setReceiptPaymentAmount(purchaseLedger.getReceiptPaymentAmount()); } // 修改发票号 // 更新来票登记 TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(productRecord.getTicketRegistrationId()); if(ticketRegistration != null){ if (ticketRegistration != null) { // 金额 = 新金额 - 旧金额 BigDecimal amountDiff = productRecordDto.getTicketsAmount().subtract(productRecord.getTicketsAmount()); // 总金额 = 原总金额 + 差值 ticketRegistration.setInvoiceAmount(ticketRegistration.getInvoiceAmount().add(amountDiff)); // 更新发票号 ticketRegistration.setInvoiceNumber(productRecordDto.getInvoiceNumber()); ticketRegistration.setInvoiceAmount(productRecordDto.getTicketsAmount()); ticketRegistrationMapper.updateById(ticketRegistration); } BeanUtils.copyProperties(productRecordDto,productRecord); BeanUtils.copyProperties(productRecordDto, productRecord); // 重新计算未来票金额(根据剩余票数 * 单价) productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice())); productRecordMapper.updateById(productRecord); return AjaxResult.success("修改成功"); } @Override @Override public ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto) { List<ProductRecordDto> productRecordDtoList = productRecordMapper.getProductRecordById(productRecordDto); if(CollectionUtils.isNotEmpty(productRecordDtoList)){ if (CollectionUtils.isNotEmpty(productRecordDtoList)) { ProductRecordDto productRecordDto1 = productRecordDtoList.stream() .filter(item -> item.getId().equals(productRecordDto.getId())) .findFirst() @@ -121,7 +139,7 @@ .filter(item -> item.getProductModelId().equals(productRecordDto.getProductModelId())) .map(ProductRecordDto::getTicketsNum) .reduce(BigDecimal.ZERO, BigDecimal::add); if(productRecordDto1 != null){ if (productRecordDto1 != null) { productRecordDto1.setFutureTickets(productRecordDto1.getQuantity().subtract(reduce)); productRecordDto1.setFutureTicketsAmount(productRecordDto1.getFutureTickets().multiply(productRecordDto1.getTaxInclusiveUnitPrice())); } src/main/java/com/ruoyi/sales/dto/StatisticsTableDto.java
@@ -21,11 +21,11 @@ private String productCategory; @ApiModelProperty(value = "开始时间") @JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM") private Date entryDateStart; @ApiModelProperty(value = "结束时间") @JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM") private Date entryDateEnd; } src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -69,7 +69,8 @@ "SUM(CASE WHEN slp.approve_status = 2 THEN 1 ELSE 0 END) / COUNT(DISTINCT sl.id) * 100), 2) AS ship_rate " + "FROM sales_ledger sl " + "LEFT JOIN sales_ledger_product slp ON sl.id = slp.sales_ledger_id " + "WHERE sl.entry_date BETWEEN #{statisticsTableDto.entryDateStart} AND #{statisticsTableDto.entryDateEnd} " + "WHERE sl.entry_date >= DATE_FORMAT(#{statisticsTableDto.entryDateStart}, '%Y-%m-01') " + "AND sl.entry_date <= LAST_DAY(#{statisticsTableDto.entryDateEnd}) " + // 产品大类筛选 "<if test='statisticsTableDto.productCategory != null and statisticsTableDto.productCategory != \"\"'>" + "AND slp.product_category = #{statisticsTableDto.productCategory} " + src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
@@ -71,6 +71,7 @@ /*查询员工信息*/ QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>(); staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername()); staffQueryWrapper.eq("staff_state", 1);//在职 StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper); if (staffOnJob == null) { throw new BaseException("当前用户没有对应的员工信息"); @@ -107,8 +108,8 @@ int actualHour = currentDateTime.getHour(); int actualMinute = currentDateTime.getMinute(); // 判断打卡时间是否晚于当前时间 if (actualHour > standardHour || (actualHour == standardHour && actualMinute > standardMinute)) { throw new BaseException(String.format("打卡失败:打卡时间不能晚于下班时间(%02d:%02d)", standardHour, standardMinute)); if (actualHour < standardHour || (actualHour == standardHour && actualMinute < standardMinute)) { throw new BaseException(String.format("打卡失败:打卡时间不能早于下班时间(%02d:%02d)", standardHour, standardMinute)); } // 根据员工ID和当前日期查询打卡记录 QueryWrapper<PersonalAttendanceRecords> attendanceQueryWrapper = new QueryWrapper<>(); @@ -176,6 +177,8 @@ return 3; // 迟到早退 } return 2; // 早退 }else if (attendanceRecord.getStatus() == 1) { return 1; // 下班打卡正常但是上班迟到 } } return 0; // 正常 @@ -192,6 +195,7 @@ if (!admin) { QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>(); staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername()); staffQueryWrapper.eq("staff_state", 1);//在职 StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper); if (staffOnJob == null) { return new Page<>(page.getCurrent(), page.getSize(), 0); @@ -210,10 +214,11 @@ // 首先根据用户ID查询员工信息 QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>(); staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername()); staffQueryWrapper.eq("staff_state", 1);//在职 StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper); if (staffOnJob == null) { return null; // 当前用户没有对应的员工信息 throw new BaseException("当前用户没有对应的员工信息"); } // 根据员工ID和当前日期查询打卡记录 @@ -253,6 +258,7 @@ if (!admin) { QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>(); staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername()); staffQueryWrapper.eq("staff_state", 1);//在职 StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper); if (staffOnJob == null) { throw new ServiceException("没有员工信息,无法导出考勤记录"); src/main/java/com/ruoyi/staff/task/PersonalAttendanceRecordsTask.java
@@ -45,7 +45,6 @@ LocalDateTime todayStart = LocalDate.now().atStartOfDay(); List<StaffOnJob> staffWithoutAttendance = personalAttendanceRecordsMapper.selectStaffWithoutAttendanceRecordBeforeTime(yesterday, todayStart); // 遍历没有考勤记录的员工,生成缺勤记录 for (StaffOnJob staff : staffWithoutAttendance) { try { @@ -59,6 +58,9 @@ absenceRecord.setDate(yesterday); absenceRecord.setStatus(4); // 设置状态为缺勤 absenceRecord.setRemark("系统自动生成-缺勤"); absenceRecord.setCreateTime(LocalDateTime.now()); absenceRecord.setUpdateTime(LocalDateTime.now()); absenceRecord.setTenantId(staff.getTenantId()); personalAttendanceRecordsService.save(absenceRecord); } catch (Exception e) { src/main/resources/mapper/staff/PersonalAttendanceRecordsMapper.xml
@@ -47,6 +47,11 @@ FROM staff_on_job soj WHERE soj.staff_state = 1 AND soj.create_time < #{entryDeadline} AND EXISTS ( SELECT 1 FROM personal_attendance_location_config palc WHERE palc.sys_dept_id = soj.sys_dept_id ) AND NOT EXISTS ( SELECT 1 FROM personal_attendance_records par