Procházet zdrojové kódy

Merge branch 'hurx'

hurx před 2 týdny
rodič
revize
623af06d09

+ 2 - 1
ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/interceptor/PlatformDataScopeInterceptor.java

@@ -123,7 +123,8 @@ public class PlatformDataScopeInterceptor implements Interceptor {
         "invoice_info",
         "sys_user_wechat",
         "mini_page_set",
-        "maintain_info"
+        "maintain_info",
+        "maintenance_server_item"
         // 注意:前缀匹配需特殊处理(如 qrtz_),见 isIgnoreTable 方法
     ));
 

+ 6 - 0
ruoyi-modules/ruoyi-bill/src/main/java/org/dromara/bill/controller/pc/PcStatementOrderController.java

@@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
+import java.util.Map;
 
 /**
  * PC端 - 对账单管理
@@ -72,6 +73,11 @@ public class PcStatementOrderController extends BaseController {
         if (bo.getIsPaymentStatus() != null && !bo.getIsPaymentStatus().isEmpty()) {
             wrapper.eq(StatementOrder::getIsPaymentStatus, bo.getIsPaymentStatus());
         }
+        Map<String, Object> params = bo.getParams();
+        if (params != null) {
+            wrapper.between(params.get("beginTime") != null && params.get("endTime") != null,
+                StatementOrder::getStatementDate, params.get("beginTime"), params.get("endTime"));
+        }
 
         // 使用新添加的 PC 端专用方法
         return statementOrderService.queryPageListByWrapper(wrapper, pageQuery);

+ 4 - 0
ruoyi-modules/ruoyi-bill/src/main/java/org/dromara/bill/service/impl/StatementInvoiceServiceImpl.java

@@ -140,6 +140,10 @@ public class StatementInvoiceServiceImpl extends ServiceImpl<StatementInvoiceMap
         lqw.eq(bo.getInvoiceTime() != null, StatementInvoice::getInvoiceTime, bo.getInvoiceTime());
         lqw.eq(StringUtils.isNotBlank(bo.getRejectRemark()), StatementInvoice::getRejectRemark, bo.getRejectRemark());
         lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), StatementInvoice::getPlatformCode, bo.getPlatformCode());
+        if (params != null) {
+            lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
+                StatementInvoice::getInvoiceTime, params.get("beginTime"), params.get("endTime"));
+        }
         return lqw;
     }
 

+ 32 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcMaintainInfoController.java

@@ -1,6 +1,7 @@
 package org.dromara.customer.controller.pc;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
 import org.dromara.common.core.domain.R;
 import org.dromara.common.core.validate.AddGroup;
@@ -8,9 +9,14 @@ import org.dromara.common.core.validate.EditGroup;
 import org.dromara.common.idempotent.annotation.RepeatSubmit;
 import org.dromara.common.log.annotation.Log;
 import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.web.core.BaseController;
+import org.dromara.customer.domain.bo.CustomerContactBo;
 import org.dromara.customer.domain.bo.MaintainInfoBo;
+import org.dromara.customer.domain.vo.CustomerContactVo;
+import org.dromara.customer.domain.vo.MaintainInfoVo;
 import org.dromara.customer.service.IMaintainInfoService;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -23,6 +29,30 @@ public class PcMaintainInfoController extends BaseController {
 
     private final IMaintainInfoService maintainInfoService;
 
+    /**
+     * 查询当前企业的维保记录
+     */
+    @GetMapping("/list")
+    public TableDataInfo<MaintainInfoVo> list(MaintainInfoBo bo, PageQuery pageQuery) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        // 强制设置企业ID,防止越权访问
+        bo.setCustomerId(customerId);
+
+        return maintainInfoService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 获取维保记录详细信息
+     *
+     * @param id 主键
+     */
+    @GetMapping("/{id}")
+    public R<MaintainInfoVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable("id") Long id) {
+        return R.ok(maintainInfoService.queryById(id));
+    }
+
     /**
      * 新增维保记录
      */
@@ -42,4 +72,6 @@ public class PcMaintainInfoController extends BaseController {
         bo.setCustomerId(customerId);
         return toAjax(maintainInfoService.updateByBo(bo));
     }
+
+
 }

+ 13 - 24
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -35,7 +35,9 @@ import org.dromara.system.api.*;
 import org.dromara.system.api.domain.bo.RemoteUserBo;
 import org.dromara.system.api.domain.dto.AddressAreaDTO;
 import org.dromara.system.api.domain.vo.RemoteDeptVo;
+import org.dromara.system.api.domain.vo.RemoteComStaffVo;
 import org.dromara.system.api.domain.vo.RemoteDictDataVo;
+import org.dromara.system.api.domain.dto.AddressAreaDTO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -186,32 +188,17 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
         // 2. 查询关联信息 - 工商信息 (增加供应商表作为备选)
         CustomerBusinessInfo businessInfo = customerBusinessInfoMapper.selectByCustomerId(id);
-        if (businessInfo == null) {
-            // 尝试从供应商工商信息表查询
-            SupplierBusinessInfo supplierBiz = supplierBusinessInfoMapper.selectById(id);
-            if (supplierBiz != null) {
-                businessInfo = BeanUtil.toBean(supplierBiz, CustomerBusinessInfo.class);
-                businessInfo.setCustomerId(id);
-                // 字段名映射差异处理
-                businessInfo.setBusinessCustomerName(supplierBiz.getBusinessName());
-                businessInfo.setSocialCreditCode(supplierBiz.getSocialCreditCode());
-                businessInfo.setLegalPersonName(supplierBiz.getLegalPersonName());
-                businessInfo.setRegisteredCapital(supplierBiz.getRegisteredCapital());
-                businessInfo.setEstablishmentDate(supplierBiz.getEstablishmentDate());
-                businessInfo.setRevocationDate(supplierBiz.getRevocationDate());
-                businessInfo.setRegistrationStatus(supplierBiz.getRegistrationStatus());
-                businessInfo.setBusinessAddress(supplierBiz.getBusinessAddress());
-                businessInfo.setBusinessLicense(supplierBiz.getBusinessLicense());
-            }
-        }
-
         if (businessInfo != null) {
             vo.setCustomerBusinessInfoVo(MapstructUtils.convert(businessInfo, CustomerBusinessInfoVo.class));
             // 补充主表缺失字段
-            if (StringUtils.isBlank(vo.getSocialCreditCode()))
+            if (StringUtils.isBlank(vo.getSocialCreditCode())){
                 vo.setSocialCreditCode(businessInfo.getSocialCreditCode());
-            if (StringUtils.isBlank(vo.getBusinessCustomerName()))
+            }
+            if (StringUtils.isBlank(vo.getBusinessCustomerName())){
                 vo.setBusinessCustomerName(businessInfo.getBusinessCustomerName());
+            }
+
+            vo.setCustomerBusinessInfoVo(BeanUtil.toBean(businessInfo, CustomerBusinessInfoVo.class));
         }
 
         // 销售信息
@@ -981,10 +968,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         Long customerId = bo.getId();
 
         // 2. 删除旧的关联数据
-        customerBusinessInfoMapper.deleteByCustomerId(customerId);
-        customerSalesInfoMapper.deleteByCustomerId(customerId);
+
 //        customerContactMapper.deleteByCustomerId(customerId);
-        customerInvoiceInfoMapper.deleteByCustomerId(customerId);
+
 
         // 3. 插入新的关联数据
         saveAssociatedData(customerId, bo);
@@ -1029,6 +1015,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     private void saveAssociatedData(Long customerId, CustomerInfoBo bo) {
         // 业务信息
         if (bo.getCustomerBusinessBo() != null) {
+            customerBusinessInfoMapper.deleteByCustomerId(customerId);
             CustomerBusinessInfo business = MapstructUtils.convert(bo.getCustomerBusinessBo(), CustomerBusinessInfo.class);
             business.setCustomerId(customerId);
             customerBusinessInfoMapper.insert(business);
@@ -1036,6 +1023,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
         // 销售信息
         if (bo.getCustomerSalesInfoBo() != null) {
+            customerSalesInfoMapper.deleteByCustomerId(customerId);
             CustomerSalesInfo sales = MapstructUtils.convert(bo.getCustomerSalesInfoBo(), CustomerSalesInfo.class);
             sales.setCustomerId(customerId);
             customerSalesInfoMapper.insert(sales);
@@ -1052,6 +1040,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
         // 发票信息列表
         if (bo.getCustomerInvoiceInfoBoList() != null && !bo.getCustomerInvoiceInfoBoList().isEmpty()) {
+            customerInvoiceInfoMapper.deleteByCustomerId(customerId);
             for (CustomerInvoiceInfoBo invoiceBo : bo.getCustomerInvoiceInfoBoList()) {
                 CustomerInvoiceInfo invoice = MapstructUtils.convert(invoiceBo, CustomerInvoiceInfo.class);
                 invoice.setCustomerId(customerId);

+ 6 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/MaintainInfoServiceImpl.java

@@ -55,7 +55,7 @@ public class MaintainInfoServiceImpl  extends ServiceImpl<MaintainInfoMapper, Ma
         MaintainInfoVo maintainInfoVo = baseMapper.selectVoById(id);
         CustomerInfoVo customerInfoVo = customerInfoMapper.selectVoById(maintainInfoVo.getCustomerId());
         if (null != customerInfoVo) {
-            maintainInfoVo.setCustomerName(customerInfoVo.getCompanyName());
+            maintainInfoVo.setCustomerName(customerInfoVo.getCustomerName());
         }
         return maintainInfoVo;
     }
@@ -91,7 +91,11 @@ public class MaintainInfoServiceImpl  extends ServiceImpl<MaintainInfoMapper, Ma
                 .map(Long::parseLong)
                 .collect(Collectors.toSet());
 
-            List<MaintenanceServerItemVo> itemList = maintenanceServerItemMapper.selectVoByIds(itemIds);
+            List<MaintenanceServerItemVo> itemList = Collections.emptyList();
+            if (CollUtil.isNotEmpty(itemIds)) {
+                // 只有当 itemIds 不为空时,才执行数据库查询
+                itemList = maintenanceServerItemMapper.selectVoByIds(itemIds);
+            }
 
             Map<Long, String> itemMap = itemList.stream()
                 .collect(Collectors.toMap(