Ver código fonte

Merge remote-tracking branch 'origin/master' into master

肖路 2 semanas atrás
pai
commit
d7074857f4

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

@@ -122,7 +122,9 @@ public class PlatformDataScopeInterceptor implements Interceptor {
         "statement_product",
         "invoice_info",
         "sys_user_wechat",
-        "mini_page_set"
+        "mini_page_set",
+        "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;
     }
 

+ 1 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcComplaintsSuggestionsController.java

@@ -29,10 +29,9 @@ public class PcComplaintsSuggestionsController extends BaseController {
     private final IComplaintsSuggestionsService pcComplaintsSuggestionsService;
 
     @GetMapping("/list")
-    public TableDataInfo<ComplaintsSuggestionsVo> getComplaintsSuggestions(PageQuery pageQuery) {
+    public TableDataInfo<ComplaintsSuggestionsVo> getComplaintsSuggestions(ComplaintsSuggestionsBo bo,PageQuery pageQuery) {
         // 获取当前登录用户的企业ID
         Long customerId = LoginHelper.getLoginUser().getCustomerId();
-        ComplaintsSuggestionsBo bo = new ComplaintsSuggestionsBo();
         bo.setCustomerId(customerId);
         return pcComplaintsSuggestionsService.queryPageList(bo, pageQuery);
     }

+ 5 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcContactController.java

@@ -161,4 +161,9 @@ public class PcContactController extends BaseController {
 
         return toAjax(customerContactService.deleteWithValidByIds(List.of(ids), true));
     }
+    /*设置主联系人*/
+    @PutMapping("/changeIsPrimary")
+    public R<Void> changeIsPrimary(@RequestBody CustomerContactBo bo) {
+        return toAjax(customerContactService.changeIsPrimary(bo));
+    }
 }

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

@@ -0,0 +1,77 @@
+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;
+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.*;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/pcMaintainInfo")
+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));
+    }
+
+    /**
+     * 新增维保记录
+     */
+    @PostMapping()
+    public R<Void> add( @RequestBody MaintainInfoBo bo) {
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        bo.setCustomerId(customerId);
+        return toAjax(maintainInfoService.insertByBo(bo));
+    }
+
+    /**
+     * 修改维保记录
+     */
+    @PutMapping()
+    public R<Void> edit( @RequestBody MaintainInfoBo bo) {
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        bo.setCustomerId(customerId);
+        return toAjax(maintainInfoService.updateByBo(bo));
+    }
+
+
+}

+ 8 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/ComplaintsSuggestionsServiceImpl.java

@@ -2,6 +2,7 @@ package org.dromara.customer.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.redis.utils.SequenceUtils;
 import org.dromara.customer.domain.CustomerContact;
 import org.dromara.customer.mapper.CustomerContactMapper;
+import org.dromara.system.api.RemoteUserService;
 import org.springframework.stereotype.Service;
 import org.dromara.customer.domain.bo.ComplaintsSuggestionsBo;
 import org.dromara.customer.domain.vo.ComplaintsSuggestionsVo;
@@ -45,6 +47,9 @@ public class ComplaintsSuggestionsServiceImpl extends ServiceImpl<ComplaintsSugg
 
     private final CustomerContactMapper customerContactMapper;
 
+    @DubboReference
+   private RemoteUserService remoteUserService;
+
     /**
      * 查询投诉与建议记录
      *
@@ -70,8 +75,9 @@ public class ComplaintsSuggestionsServiceImpl extends ServiceImpl<ComplaintsSugg
         List<ComplaintsSuggestionsVo> records = result.getRecords();
         if (CollUtil.isNotEmpty(records)) {
             Set<Long> createByIds = records.stream().map(ComplaintsSuggestionsVo::getCreateBy).collect(Collectors.toSet());
-            List<CustomerContact> customerContacts = customerContactMapper.selectByIds(createByIds);
-            Map<Long, String> createByMap = customerContacts.stream().collect(Collectors.toMap(CustomerContact::getId, CustomerContact::getContactName));
+
+            List<CustomerContact> customerContacts = customerContactMapper.selectList(new LambdaQueryWrapper<CustomerContact>().in(CustomerContact::getUserId, createByIds));
+            Map<Long, String> createByMap = customerContacts.stream().collect(Collectors.toMap(CustomerContact::getUserId, CustomerContact::getContactName));
             records.forEach(r -> {
                 r.setCreateName(createByMap.get(r.getCreateBy()));
             });

+ 1 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerContactServiceImpl.java

@@ -353,7 +353,7 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
                     .eq(CustomerContact::getIsPrimary, SysPlatformYesNo.YES.getCode())
             );
 
-            // 2. 设置当前地址为默认
+            // 2. 设置当前为默认
             CustomerContact current = new CustomerContact();
             current.setId(bo.getId());
             current.setIsPrimary(SysPlatformYesNo.YES.getCode());

+ 20 - 31
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);
@@ -1215,13 +1204,13 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     public Boolean register(CustomerRegisterBo bo) {
         //先校验验证码是否正确
         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
-//        if (code == null) {
-//            throw new ServiceException("验证码已过期");
-//        }
-//
-//        if (!code.equals(bo.getCode())) {
-//            throw new ServiceException("验证码错误");
-//        }
+        if (code == null) {
+            throw new ServiceException("验证码已过期");
+        }
+
+        if (!code.equals(bo.getCode())) {
+            throw new ServiceException("验证码错误");
+        }
 
         //校验密码与确认密码是否一致
         if (!bo.getPassword().equals(bo.getConfirmPassword())) {

+ 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(

+ 12 - 5
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderDeliverServiceImpl.java

@@ -13,7 +13,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.enums.OrderStatus;
 import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.utils.MapstructUtils;
-import org.dromara.common.core.utils.ObjectUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -25,10 +24,8 @@ import org.dromara.order.domain.OrderMain;
 import org.dromara.order.domain.OrderStatusLog;
 import org.dromara.order.domain.bo.OrderDeliverBo;
 import org.dromara.order.domain.bo.OrderDeliverProductBo;
-import org.dromara.order.domain.bo.OrderStatusLogBo;
 import org.dromara.order.domain.vo.OrderDeliverProductVo;
 import org.dromara.order.domain.vo.OrderDeliverVo;
-import org.dromara.order.domain.vo.OrderMainVo;
 import org.dromara.order.domain.vo.OrderQuantitySummary;
 import org.dromara.order.mapper.*;
 import org.dromara.order.service.IOrderDeliverService;
@@ -505,12 +502,22 @@ public class OrderDeliverServiceImpl extends ServiceImpl<OrderDeliverMapper, Ord
                         BigDecimal::add
                     )
                 ));
+            Map<Long, Long> OrderIdAndCreateUserId = orderMainList.stream()
+                .collect(Collectors.toMap(
+                    OrderMain::getId,
+                    OrderMain::getCreateBy
+                ));
+            Map<Long, Long> OrderIdAndDeptId = orderMainList.stream()
+                .collect(Collectors.toMap(
+                    OrderMain::getId,
+                    OrderMain::getCreateDept
+                ));
 
             // 4. 回填 totalAmount 和其他字段
             for (OrderDeliverVo record : records) {
                 record.setTotalAmount(deliverIdToTotalAmount.getOrDefault(record.getId(), BigDecimal.ZERO));
-                record.setCreateName(userMap.getOrDefault(record.getCreateBy(), "未知用户"));
-                record.setCreateDeptName(deptMap.getOrDefault(record.getCreateDept(), "未知部门"));
+                record.setCreateName(userMap.get(OrderIdAndCreateUserId.get(record.getOrderId())));
+                record.setCreateDeptName(deptMap.get(OrderIdAndDeptId.get(record.getOrderId())));
                 record.setOrderTime(orderIdToorderTimeMap.get(record.getOrderId()));
             }
         }