Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

hurx 2 долоо хоног өмнө
parent
commit
d7db00dc8a

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

@@ -246,6 +246,11 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
         } else {
             // 情况 C:完全没数据 -> 创建新用户
             userId = remoteUserService.addUser(remoteUserBo);
+            if (ObjectUtil.isNotEmpty(bo.getRoleId())) {
+                remoteUserBo.setUserId(userId);
+                remoteUserBo.setRoleId(bo.getRoleId());
+                remoteUserService.addUserRole(remoteUserBo);
+            }
         }
 
         if (userId == null) {
@@ -303,6 +308,12 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
             remoteUserService.addUserRole(remoteUserBo);
         }
         boolean flag = baseMapper.updateById(update) > 0;
+        if (ObjectUtil.isNotEmpty(bo.getRoleId())) {
+            RemoteUserBo remoteUserBo = new RemoteUserBo();
+            remoteUserBo.setUserId(update.getUserId());
+            remoteUserBo.setRoleId(bo.getRoleId());
+            remoteUserService.addUserRole(remoteUserBo);
+        }
         if (flag) {
             try {
                 // 更新或插入扩展信息

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

@@ -1396,7 +1396,8 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         String contactNo = "1" + customerNo + seqId;
         contact.setContactNo(contactNo);
         contact.setUserId(userId);
-        contact.setRoleId(1L);
+        contact.setRoleId(2049022448332603393L);
+        contact.setRoleName("管理角色");
         contact.setContactName(bo.getPurchaseName());
         contact.setPhone(bo.getPurchasePhone());
         contact.setCustomLoginName(bo.getPurchasePhone());

+ 14 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java

@@ -376,9 +376,18 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         );
         if(supplierInfoTemporary == null){
             supplierInfoTemporary = new SupplierInfoTemporary();
+            BeanUtils.copyProperties(bo, supplierInfoTemporary, "id");
+            supplierInfoTemporary.setSupplyStatus(bo.getSupplyStatus());
+            supplierInfoTemporaryService.saveOrUpdate(supplierInfoTemporary);
+        }else{
+            if(bo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()){
+                supplierInfoTemporary.setSupplyStatus(bo.getSupplyStatus());
+                supplierInfoTemporaryService.saveOrUpdate(supplierInfoTemporary);
+                SupplierInfo supplierInfo = BeanUtil.toBean(supplierInfoTemporary, SupplierInfo.class);
+                supplierInfo.setId(supplierInfoTemporary.getSupplierId());
+                return baseMapper.updateById(supplierInfo) > 0;
+            }
         }
-        BeanUtils.copyProperties(bo, supplierInfoTemporary, "id");
-        supplierInfoTemporaryService.saveOrUpdate(supplierInfoTemporary);
 
         SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
         return baseMapper.updateById(update) > 0;
@@ -783,6 +792,9 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         if (!CollectionUtils.isEmpty(tempRecords)) {
             supplierVos = tempRecords.stream().map(temp -> {
                 SupplierInfoVo supplierInfo = baseMapper.selectVoById(temp.getSupplierId());
+                if (supplierInfo == null) {
+                    return null;
+                }
                 SupplierInfoVo vo = new SupplierInfoVo();
 
                 BeanUtil.copyProperties(temp, vo);

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

@@ -178,7 +178,7 @@ public class SupplierInfoTemporaryServiceImpl  extends ServiceImpl<SupplierInfoT
             add.setSupplyStatus(bo.getSupplyStatus());
             return baseMapper.updateById(add) > 0;
         }else{
-            if (bo.getSupplierId() != null) {
+            if (bo.getId() != null) {
                 SupplierInfo supplierInfo = supplierInfoMapper.selectById(bo.getId());
                 if (supplierInfo != null) {
                     add.setSupplierId(supplierInfo.getId());

+ 2 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/IOrderCustomerFlowService.java

@@ -80,8 +80,9 @@ public interface IOrderCustomerFlowService extends IService<OrderCustomerFlow>{
     /**
     * 初始化订单流程
      * @param orderId 订单ID
+     * @param   contactId  联系人id
     * */
-    Boolean initOrderFlow(Long orderId);
+    Boolean initOrderFlow(Long orderId,Long contactId);
 
     /**
     * 审核订单流程

+ 22 - 4
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderCustomerFlowServiceImpl.java

@@ -33,6 +33,7 @@ import org.dromara.order.service.IOrderCustomerFlowService;
 import org.dromara.order.service.IOrderCustomerFlowNodeService;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 import org.springframework.transaction.annotation.Transactional;
 
@@ -205,7 +206,11 @@ public class OrderCustomerFlowServiceImpl extends ServiceImpl<OrderCustomerFlowM
             deleteWrapper.eq(OrderCustomerFlowNode::getFlowId, flowId);
             nodeService.remove(deleteWrapper);
         }
-
+        //关闭其它流程
+        baseMapper.update(Wrappers.lambdaUpdate(OrderCustomerFlow.class)
+            .set(OrderCustomerFlow::getStatus, "1")
+            .ne(OrderCustomerFlow::getId, flowId)
+        );
         return true;
     }
 
@@ -231,7 +236,8 @@ public class OrderCustomerFlowServiceImpl extends ServiceImpl<OrderCustomerFlowM
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean initOrderFlow(Long orderId) {
+    public Boolean initOrderFlow(Long orderId, Long contactId) {
+
         //查询默认开启的流程
         OrderCustomerFlow flow = baseMapper.selectOne(
             new LambdaQueryWrapper<OrderCustomerFlow>()
@@ -250,10 +256,22 @@ public class OrderCustomerFlowServiceImpl extends ServiceImpl<OrderCustomerFlowM
         if (ObjectUtil.isEmpty(orderCustomerFlowNodes)) {
             return false;
         }
-        //
+        //过滤出开始节点
+        OrderCustomerFlowNode startNode = orderCustomerFlowNodes.stream().filter(node -> node.getNodeType() == 0).findFirst().orElse(null);
+        if (ObjectUtil.isEmpty(startNode) ) {
+            return false;
+        }
+        if (!startNode.getHandlerId().contains(String.valueOf(contactId))){
+            return false;
+        }
+        if (ObjectUtil.isEmpty(startNode.getHandlerId()) || Objects.equals(startNode.getHandlerId(), "0")){
+            return false;
+        }
+        //过滤出中间节点
+        List<OrderCustomerFlowNode> middleNodes = orderCustomerFlowNodes.stream().filter(node -> node.getNodeType() == 1).collect(Collectors.toList());
         List<OrderCustomerFlowNodeLink> orderCustomerFlowNodeLinks = new ArrayList<>();
         //先初始化流程节点
-        for (OrderCustomerFlowNode orderCustomerFlowNode : orderCustomerFlowNodes) {
+        for (OrderCustomerFlowNode orderCustomerFlowNode : middleNodes) {
             OrderCustomerFlowNodeLink nodeLink = BeanUtil.toBean(orderCustomerFlowNode, OrderCustomerFlowNodeLink.class);
             nodeLink.setId(null);
             nodeLink.setOrderId(orderId);

+ 1 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java

@@ -652,7 +652,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
         // 2. 校验插入是否成功
         if (orderId != null && orderId > 0) {
             // 3. 初始化审批流程
-            Boolean initOrderFlow = orderCustomerFlowService.initOrderFlow(orderId);
+            Boolean initOrderFlow = orderCustomerFlowService.initOrderFlow(orderId, mainBo.getContactId());
 
             // 4. 如果流程初始化成功,更新订单状态 (注意:这里再次触发了数据库更新)
             if (initOrderFlow) {

+ 1 - 1
ruoyi-modules/ruoyi-product/src/main/resources/mapper/product/ProductBrandMapper.xml

@@ -9,8 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM product_category category
         INNER JOIN product_base product ON product.top_category_id = category.id
         INNER JOIN product_brand brand ON brand.id = product.brand_id
-        WHERE brand.is_show = 1
         <where>
+            brand.is_show = 1
             <if test="categoryId != null">
                 AND category.id = #{categoryId}
             </if>

+ 14 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/pc/IndexSystemController.java

@@ -6,7 +6,10 @@ import org.dromara.common.core.domain.R;
 import org.dromara.common.core.enums.SysPlatformYesNo;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.system.domain.*;
+import org.dromara.system.domain.bo.PlatformConfigBo;
+import org.dromara.system.domain.vo.PlatformConfigVo;
 import org.dromara.system.service.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -52,6 +55,17 @@ public class IndexSystemController {
     //获取导航信息
     private final IPlatformNavigationService platformNavigationService;
 
+    private final IPlatformConfigService platformConfigService;
+
+    /**
+    * 平台设置-基本设置
+    * */
+    @GetMapping("/getPlatformConfigList")
+    public TableDataInfo<PlatformConfigVo> list(PlatformConfigBo bo, PageQuery pageQuery) {
+        bo.setConfigType("0");
+        return platformConfigService.queryPageList(bo, pageQuery);
+    }
+
     /**
      * 平台设置-搜索导航
      */

+ 10 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysRoleController.java

@@ -24,6 +24,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 角色信息
@@ -227,6 +228,15 @@ public class SysRoleController extends BaseController {
         return R.ok(selectVo);
     }
 
+    @GetMapping("/getWorkbenchRoleList")
+    public R<List<SysRoleVo>> getWorkbenchRoleList(SysRoleBo bo) {
+        bo.setPlatformCode("home");
+        List<SysRoleVo> roleList = roleService.selectRoleList(bo);
+        //将游客角色过滤掉
+        roleList = roleList.stream().filter(role -> !Objects.equals(role.getRoleKey(), "tourist")&& !Objects.equals(role.getRoleKey(), "admin")).toList();
+        return R.ok(roleList);
+    }
+
     public record DeptTreeSelectVo(List<Long> checkedKeys, List<Tree<Long>> depts) {}
 
 }