Bladeren bron

update:套餐包所属公司多选,待推送订单

ct 2 dagen geleden
bovenliggende
commit
de4c4ce093

+ 24 - 2
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreProductPackageScrmController.java

@@ -8,6 +8,7 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.hisStore.domain.FsStoreProductScrm;
 import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
@@ -25,8 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 /**
  * 商品组合套餐Controller
@@ -132,6 +132,28 @@ public class FsStoreProductPackageScrmController extends BaseController
         return AjaxResult.success(productPackage);
     }
 
+    /**
+     * 查询所选套餐商品所属公司
+     */
+    @PostMapping("/getProductsCompanyIds")
+    public R getProductsCompanyIds(@RequestBody List<Long> productIds)
+    {
+        List<FsStoreProductScrm> list = storeProductService.getStoreProductInProductIds(productIds);
+        Set<String> companyIds = new LinkedHashSet<>();
+        if(list!=null&& !list.isEmpty()) {
+            list.forEach(fsStoreProductScrm -> {
+                String companyIdsTemp = fsStoreProductScrm.getCompanyIds();
+                if (StringUtils.isNotBlank(companyIdsTemp)) {
+                    List<String> companyIdList = Arrays.asList(companyIdsTemp.split(","));
+                    if (!companyIdList.isEmpty()) {
+                        companyIds.addAll(companyIdList);
+                    }
+                }
+            });
+        }
+        return R.ok().put("companyIds", companyIds);
+    }
+
     /**
      * 批量修改商品组合套餐
      */

+ 13 - 0
fs-service/src/main/java/com/fs/hisStore/domain/FsStoreProductPackageScrm.java

@@ -51,6 +51,11 @@ public class FsStoreProductPackageScrm extends BaseEntity
     @Excel(name = "公司ID")
     private Long companyId;
 
+
+    /** 公司ID */
+    @Excel(name = "公司ID")
+    private String companyIds;
+
     @Excel(name = "部门ID")
     private Long deptId;
 
@@ -224,4 +229,12 @@ public class FsStoreProductPackageScrm extends BaseEntity
     public void setIntegral(Integer integral) {
         this.integral = integral;
     }
+
+    public String getCompanyIds() {
+        return companyIds;
+    }
+
+    public void setCompanyIds(String companyIds) {
+        this.companyIds = companyIds;
+    }
 }

+ 6 - 0
fs-service/src/main/java/com/fs/hisStore/dto/StoreOrderProductDTO.java

@@ -5,6 +5,7 @@ import lombok.*;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.List;
 
 @Getter
 @Setter
@@ -38,4 +39,9 @@ public class StoreOrderProductDTO implements Serializable {
     @Excel(name = "商品数量")
     private Integer count;
 
+    /**
+     * 所属公司id
+     */
+    private List<Long> companyIdList;
+
 }

+ 0 - 18
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductPackageScrmMapper.java

@@ -64,24 +64,6 @@ public interface FsStoreProductPackageScrmMapper
      */
     public int deleteFsStoreProductPackageByIds(Long[] packageIds);
 
-    @Select({"<script> " +
-            "select p.*,c.company_name,d.dept_name  from fs_store_product_package_scrm p   left join company_dept d on d.dept_id=p.dept_id left join company c on c.company_id=p.company_id  " +
-            "where 1=1 " +
-            "<if test = 'maps.title != null and  maps.title !=\"\"    '> " +
-            "and p.title like CONCAT('%',#{maps.title},'%') " +
-            "</if>" +
-            "<if test = 'maps.cateId != null      '> " +
-            "and p.cate_id =#{maps.cateId} " +
-            "</if>" +
-            "<if test = 'maps.companyId != null      '> " +
-            "and (p.company_id =#{maps.companyId}) " +
-            "</if>" +
-            "<if test = 'maps.status != null      '> " +
-            "and p.status =#{maps.status} " +
-            "</if>" +
-//            " ${maps.params.dataScope} "+
-            " order by p.sort desc "+
-            "</script>"})
     List<FsStoreProductPacketVO> selectFsStoreProductPackageListVO(@Param("maps") FsStoreProductPackageScrm fsStoreProductPackage);
     @Select({"<script> " +
             "select p.*,c.company_name,d.dept_name  from fs_store_product_package_scrm p   left join company_dept d on d.dept_id=p.dept_id left join company c on c.company_id=p.company_id  " +

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -385,7 +385,7 @@ public interface FsStoreProductScrmMapper
 
     List<FsStoreProductScrm> bulkCopyFsStoreProductByIds(Long[] productIds);
 
-    List<FsStoreProductScrm> getStoreProductInProductIds(List<Long> productIds);
+    List<FsStoreProductScrm> getStoreProductInProductIds(@Param("productIds")List<Long> productIds);
 
     @Select({"<script> " +
             "SELECT distinct fsp.* FROM fs_store_product_scrm fsp " +

+ 1 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreProductPacketVO.java

@@ -50,6 +50,7 @@ public class FsStoreProductPacketVO implements Serializable
     private Integer payType;
     private Integer limitCount;
     private Long companyId;
+    private String companyIds;
     private Long companyUserId;
 
     //@Excel(name = "公司名称")

+ 1 - 1
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1811,7 +1811,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and o.status = #{maps.status}
             </if>
             <if test="maps.status == 6">
-                and o.`status`= 2
+                and o.`status`= 1
                 and  ( o.extend_order_id is null or  o.extend_order_id like '')
             </if>
             <if test="maps.isUpload != null and maps.isUpload == 0    ">

+ 28 - 1
fs-service/src/main/resources/mapper/hisStore/FsStoreProductPackageScrmMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="money"    column="money"    />
         <result property="payMoney"    column="pay_money"    />
         <result property="companyId"    column="company_id"    />
+        <result property="companyIds"    column="company_ids"    />
         <result property="deptId"    column="dept_id"    />
         <result property="payType"    column="pay_type"    />
         <result property="limitCount"    column="limit_count"    />
@@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectFsStoreProductPackageVo">
-        select package_id, title, descs, content, img_url,images, products, money, pay_money, company_id,
+        select package_id, title, descs, content, img_url,images, products, money, pay_money, company_id,company_ids,
                dept_id,pay_type,limit_count,cate_id,sort,status,integral from fs_store_product_package_scrm
     </sql>
 
@@ -52,6 +53,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsStoreProductPackageVo"/>
         where package_id = #{packageId}
     </select>
+    <select id="selectFsStoreProductPackageListVO" resultType="com.fs.hisStore.vo.FsStoreProductPacketVO">
+        select p.* from fs_store_product_package_scrm p
+        <where>
+            <if test='maps.title != null and maps.title != ""'>
+                and p.title like CONCAT('%',#{maps.title},'%')
+            </if>
+            <if test='maps.cateId != null'>
+                and p.cate_id = #{maps.cateId}
+            </if>
+            <if test='maps.companyId != null'>
+                and FIND_IN_SET(#{maps.companyId}, p.company_ids)
+            </if>
+            <if test='maps.status != null'>
+                and p.status = #{maps.status}
+            </if>
+        </where>
+        ${maps.params.dataScope}
+        order by p.sort desc
+    </select>
 
     <insert id="insertFsStoreProductPackage" parameterType="FsStoreProductPackageScrm">
         insert into fs_store_product_package_scrm
@@ -66,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="money != null">money,</if>
             <if test="payMoney != null">pay_money,</if>
             <if test="companyId != null">company_id,</if>
+            <if test="companyIds != null">company_ids,</if>
             <if test="deptId != null">dept_id,</if>
             <if test="payType != null">pay_type,</if>
             <if test="limitCount != null">limit_count,</if>
@@ -85,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="money != null">#{money},</if>
             <if test="payMoney != null">#{payMoney},</if>
             <if test="companyId != null">#{companyId},</if>
+            <if test="companyIds != null">#{companyIds},</if>
             <if test="deptId != null">#{deptId},</if>
             <if test="payType != null">#{payType},</if>
             <if test="limitCount != null">#{limitCount},</if>
@@ -107,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="money != null">money = #{money},</if>
             <if test="payMoney != null">pay_money = #{payMoney},</if>
             <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="companyIds != null">company_ids = #{companyIds},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="payType != null">pay_type = #{payType},</if>
             <if test="limitCount != null">limit_count = #{limitCount},</if>
@@ -138,6 +161,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                  company_id = #{companyId},
                                                  products = null
                                              </if>
+                                <if test="companyIds !=null">
+                                                    company_ids = #{companyIds},
+                                                    products = null
+                                                </if>
                                          where package_id in
         <foreach item="packageId" collection="packageIds" open="(" separator="," close=")">
             #{packageId}