ソースを参照

Merge remote-tracking branch 'origin/master'

dongke 1 年間 前
コミット
f99c59cf9f

+ 10 - 0
src/main/java/com/dk/mdm/controller/common/CommonController.java

@@ -810,6 +810,16 @@ public class CommonController extends BaseController<Map<String, Object>> {
         return commonService.getUnitNoPage(param);
     }
 
+    /**
+     * @desc :  获取用户授权数
+     * @author : 周兴
+     * @date : 2024/5/30 11:26
+     */
+    @ApiOperation(value = "获取用户授权数", notes = "获取用户授权数")
+    @PostMapping({"select_user_count"})
+    public ResponseResultVO<Map<String, Object>> selectUserCount(@RequestBody Map<String, Object> param) {
+        return commonService.selectUserCount(param);
+    }
 }
 
 

+ 8 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.java

@@ -1,6 +1,7 @@
 package com.dk.mdm.mapper.common;
 
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.StaffQuery;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -556,4 +557,11 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
      * @author : 姜永辉
      */
     Map<String, Object> getHomeOrderRecCost(Map param);
+
+    /**
+     * @desc   : 查询用户授权数据
+     * @author : 周兴
+     * @date   : 2024/5/30 10:42
+     */
+    Map<String,Object> selectUserCount(Map param);
 }

+ 29 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -1925,4 +1925,33 @@
     <select id="getHomeOrderRecCost" resultType="java.util.Map">
         select dkic_b.f_get_home_order_rec_cost(#{cpId},#{dateBegin}::date,#{dateEnd}::date)
     </select>
+
+    <!--查询用户授权数-->
+    <select id="selectUserCount" resultType="java.util.Map">
+        SELECT
+            (
+                SELECT COUNT
+                           ( 1 ) "webNum"
+                FROM
+                    dkic_b.t_mst_staff s
+                WHERE
+                    s.flg_valid
+                  AND s.flg_can_login
+                  AND s.login_type IN ( 1, 3 )
+                  AND s.hr_status = 1
+                  AND s.cp_id = #{cpId}
+            ),
+            (
+                SELECT COUNT
+                           ( 1 ) "wxNum"
+                FROM
+                    dkic_b.t_mst_staff s
+                WHERE
+                    s.flg_valid
+                  AND s.flg_can_login
+                  AND s.hr_status = 1
+                  AND s.login_type IN ( 2, 3 )
+                  AND s.cp_id = #{cpId}
+            )
+    </select>
 </mapper>

+ 1 - 0
src/main/java/com/dk/mdm/mapper/mst/StaffMapper.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @desc   : 员工 Mapper

+ 1 - 0
src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml

@@ -184,6 +184,7 @@
         AND t.cp_id = #{cpId}
     </select>
 
+
     <!-- 根据用户Id更新dkic_a.t_wx_user的cpid-->
 <!--    <update id="updateWxInfoByUserId">-->
 <!--        update dkic_a.t_wx_user -->

+ 226 - 21
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -292,9 +292,17 @@
     <!-- 出库明细报表明细条件列 -->
     <sql id="Condition_OutboundDetailReport">
         <where>
+            t.flg_valid
             <if test="cpId != null">
                 AND t.cp_id = #{cpId}
             </if>
+            <if test="outTypeRList != null and outTypeRList.size()>0">
+                AND t.out_type =any(#{outTypeRList,typeHandler=StringListTypeHandler})
+            </if>
+            <if test="outTypeRList == null || outTypeRList.size()==0">
+                AND (t.out_type = '出库类型-其他出库'
+                    or t.out_type =  '出库类型-销售出库')
+            </if>
             <if test="outNo != null and outNo != ''">
                 AND t.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
             </if>
@@ -348,12 +356,116 @@
             <if test="skuModel != null and skuModel != ''">
                 AND tmgs.sku_model like concat('%', my_ex.likequery(#{skuModel}) , '%')
             </if>
+            <if test="brandName != null and brandName != ''">
+                AND tmgb.brand_name like concat('%', my_ex.likequery(#{brandName}) , '%')
+            </if>
+            <if test="whName != null and whName != ''">
+                AND tmw.wh_name like concat('%', my_ex.likequery(#{whName}) , '%')
+            </if>
+            <if test="nonStdCode != null and nonStdCode != ''">
+                AND tpi.non_std_code like concat('%', my_ex.likequery(#{nonStdCode}) , '%')
+            </if>
+            <if test="searchText !=null and searchText != ''">
+                AND (
+                t.out_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                )
+            </if>
             <if test="whList != null  and whList.size()>0">
                 AND tpi.wh_id =
                 any(#{whList,typeHandler=UuidListTypeHandler})
             </if>
         </where>
     </sql>
+
+    <!-- 出库明细报表明细条件列-入库类型-采退入库 -->
+    <sql id="Condition_OutInboundDetailReport">
+        <where>
+            tpi.flg_valid
+            <if test="cpId != null">
+                AND tpi.cp_id = #{cpId}
+            </if>
+            <if test="outTypeRList != null and outTypeRList.size()>0">
+                AND tpi.into_type =any(#{outTypeRList,typeHandler=StringListTypeHandler})
+            </if>
+            <if test="outTypeRList == null || outTypeRList.size()==0">
+                AND tpi.into_type = '入库类型-采退入库'
+            </if>
+            <if test="outNo != null and outNo != ''">
+                AND tpi.into_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
+            </if>
+            <if test="supIdlist != null and supIdlist.size()>0">
+                AND tpi.sup_id = any(#{supIdlist,typeHandler=UuidListTypeHandler})
+            </if>
+
+            <if test="outTypeList != null and outTypeList.size()>0">
+                AND tpi.into_type =any(#{outTypeList,typeHandler=StringListTypeHandler})
+            </if>
+            <if test="fromNo != null and fromNo != ''">
+                AND tpi.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
+            </if>
+            <if test="cusName != null and cusName != ''">
+                AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
+            </if>
+            <if test="orgIdList != null and orgIdList.size() > 0">
+                AND tpi.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="staffIdList != null and staffIdList.size() > 0">
+                AND tpi.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="outStatusList != null and outStatusList.size() > 0">
+                AND tpi.into_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
+            </if>
+            <if test="outDateStart != null and outDateEnd != null">
+                AND tpi.out_date &gt;= #{outDateStart}::timestamp with time zone
+                AND tpi.out_date &lt; #{outDateEnd}::timestamp with time zone + interval '1 day'
+            </if>
+            <if test="makeTimeStart != null and makeTimeEnd != null">
+                AND tpi.make_time &gt;= #{makeTimeStart}::timestamp with time zone
+                AND tpi.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
+            </if>
+            <if test="goodsSeriesList != null  and goodsSeriesList.size()>0">
+                AND tmgs.series_id =
+                any(#{goodsSeriesList,typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="goodsCategoryList != null  and goodsCategoryList.size()>0">
+                AND tmgs.category_id =
+                any(#{goodsCategoryList,typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="goodsBrandList != null  and goodsBrandList.size()>0">
+                AND tmgs.brand_id =
+                any(#{goodsBrandList,typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="skuName != null and skuName != ''">
+                AND tmgs.sku_name like concat('%', my_ex.likequery(#{skuName}) , '%')
+            </if>
+            <if test="skuModel != null and skuModel != ''">
+                AND tmgs.sku_model like concat('%', my_ex.likequery(#{skuModel}) , '%')
+            </if>
+            <if test="brandName != null and brandName != ''">
+                AND tmgb.brand_name like concat('%', my_ex.likequery(#{brandName}) , '%')
+            </if>
+            <if test="whName != null and whName != ''">
+                AND tmw.wh_name like concat('%', my_ex.likequery(#{whName}) , '%')
+            </if>
+            <if test="nonStdCode != null and nonStdCode != ''">
+                AND tpii.non_std_code like concat('%', my_ex.likequery(#{nonStdCode}) , '%')
+            </if>
+            <if test="searchText !=null and searchText != ''">
+                AND (
+                tpi.into_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                )
+            </if>
+            <if test="whList != null  and whList.size()>0">
+                AND tpii.wh_id =
+                any(#{whList,typeHandler=UuidListTypeHandler})
+            </if>
+        </where>
+    </sql>
+
     <!-- 出库明细报表主表条件列 -->
     <sql id="Condition_OutboundReport">
         <where>
@@ -900,6 +1012,7 @@
     </select>
     <!-- 出库明细报表明细 -->
     <select id="getOutboundDetailReport" resultType="java.util.Map">
+        select * from (
         select
         t.out_id as "outId"
         ,t.out_no as "outNo"
@@ -935,15 +1048,16 @@
         ,tmgc.cat_name as "catName"
         ,series.series_name as "seriesName"
         ,sys.f_remove_zero(tpoi.outing_qty) as "outingQty"
-        ,concat(sys.f_remove_zero(tpoi.outing_qty),tmgu.unit_name)  as "outingQtyPiece"
+        ,concat(sys.f_remove_zero(tpoi.outing_qty),tmgu.unit_name) as "outingQtyPiece"
         ,tpoi.outing_amt as "outingAmt"
-        ,concat(sys.f_remove_zero(tpoi.out_qty),tmgu.unit_name)   as "outQtyPiece"
+        ,concat(sys.f_remove_zero(tpoi.out_qty),tmgu.unit_name) as "outQtyPiece"
         ,sys.f_remove_zero(tpoi.out_qty) as "outQty"
         ,tpoi.out_amt as "outAmt"
         ,sys.f_remove_zero(tpoi.return_qty) as "returnQty"
         ,tpoi.return_amt as "returnAmt"
         ,dkic_b.f_box_piece(tmgus.unit_name,tmgu.unit_name,tpoi.outing_box,tpoi.outing_piece) as "outingBoxPiece"
         ,dkic_b.f_box_piece(tmgus.unit_name,tmgu.unit_name,tpoi.out_box,tpoi.out_piece) as "outBoxPiece"
+        ,t.op_update_time
         FROM dkic_b.t_psi_outbound as t
         left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
         Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
@@ -963,31 +1077,122 @@
         left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
         left join dkic_b.t_mst_unit as tmgus on tmgs.sub_unit_id = tmgus.unit_id
         <include refid="Condition_OutboundDetailReport"/>
-        order by tpoi.op_create_time desc
+        union all
+        select
+        tpi.into_id as "outId"
+        ,tpi.into_no as "outNo"
+        ,tpi.from_no as "fromNo"
+        ,tmo.org_name as "orgName"
+        ,tms.staff_name as "staffName"
+        ,tmc.cus_id as "cusId"
+        ,tmc.cus_name as "cusName"
+        ,tmc.cus_phone as "cusPhone"
+        ,tmc.cus_from as "cusFrom"
+        ,tmc.contact_phone as "contactPhone"
+        ,tmc.address_full as "addressFull"
+        ,tmdd.data_value as cus_from_name
+        ,tmp.sup_name as "supplierName"
+        ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "outStatusName"
+        ,sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) as "outTypeName"
+        ,sys.f_remove_zero(tpi.intoing_qty) as "outingQtySum"
+        ,tpi.intoing_amt as "outingAmtSum"
+        ,sys.f_remove_zero(tpi.into_qty) as "outQtySum"
+        ,tpi.into_amt as "outAmtSum"
+        ,sys.f_remove_zero(tpi.return_qty) as "returnOutQtySum"
+        ,tpi.return_amt as "returnOutAmtSum"
+        ,tpi.into_date as "outDate"
+        ,tpi.remarks
+        ,makestaff.staff_name as "makeStaffName"
+        ,tmgs.sku_name as "skuName"
+        ,tmgs.sku_model as "skuModel"
+        ,tmgs.sku_spec as "skuSpec"
+        ,tpii.non_std_code as "nonStdCode"
+        ,tmgb.short_name as "shortName"
+        ,tmgb.brand_name as "brandName"
+        ,tmw.wh_name as "whName"
+        ,tmgc.cat_name as "catName"
+        ,series.series_name as "seriesName"
+        ,sys.f_remove_zero(tpii.intoing_qty) as "outingQty"
+        ,concat(sys.f_remove_zero(abs(tpii.intoing_qty)),tmgu.unit_name) as "outingQtyPiece"
+        ,tpii.intoing_amt as "outingAmt"
+        ,concat(sys.f_remove_zero(abs(tpii.into_qty)),tmgu.unit_name) as "outQtyPiece"
+        ,sys.f_remove_zero(tpii.into_qty) as "outQty"
+        ,tpii.into_amt as "outAmt"
+        ,sys.f_remove_zero(tpii.return_qty) as "returnQty"
+        ,tpii.return_amt as "returnAmt"
+        ,dkic_b.f_box_piece(tmgus.unit_name,tmgu.unit_name,abs(tpii.intoing_box),abs(tpii.intoing_piece)) as "outingBoxPiece"
+        ,dkic_b.f_box_piece(tmgus.unit_name,tmgu.unit_name,abs(tpii.into_box),abs(tpii.into_piece)) as "outBoxPiece"
+        ,tpi.op_update_time
+        FROM dkic_b.t_psi_inbound as tpi
+        left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
+        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+        left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
+        left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = tpi.make_staff
+        left join dkic_b.t_mst_customer tmc on tmc.cus_id = tpi.cus_id
+        left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
+        left join sys.t_data_kind as tdk1 on tdk1.kind_code = tpi.into_status
+        left join sys.t_data_kind tdktype ON tdktype.kind_code = tpi.into_type
+        left join dkic_b.t_psi_inbound_item as tpii on tpii.into_id = tpi.into_id
+        left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpii.sku_id
+        left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
+        left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
+        left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
+        left join dkic_b.t_psi_inventory as tpin on tpin.inv_id = tpii.inv_id
+        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
+        left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
+        left join dkic_b.t_mst_unit as tmgus on tmgs.sub_unit_id = tmgus.unit_id
+        <include refid="Condition_OutInboundDetailReport"/>
+        ) tt
+        order by tt.op_update_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
     </select>
     <!-- 出库明细报表明细Count-->
     <select id="getOutboundDetailReportCount" resultType="java.lang.Long">
-        SELECT count(1)
-        FROM dkic_b.t_psi_outbound as t
-        left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
-        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
-        left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
-        left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
-        left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
-        left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
-        left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
-        left join sys.t_data_kind tdktype   ON tdktype.kind_code = t.out_type
-        left join dkic_b.t_psi_outbound_item as tpoi on tpoi.out_id = t.out_id
-        left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpoi.sku_id
-        left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
-        left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
-        left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
-        left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
-        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
-        <include refid="Condition_OutboundDetailReport"/>
+        SELECT
+        count(1) from (
+            SELECT 1
+            FROM dkic_b.t_psi_outbound as t
+            left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+            Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
+            left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+            left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+            left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
+            left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
+            left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
+            left join sys.t_data_kind tdktype ON tdktype.kind_code = t.out_type
+            left join dkic_b.t_psi_outbound_item as tpoi on tpoi.out_id = t.out_id
+            left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpoi.sku_id
+            left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
+            left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
+            left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
+            left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
+            left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
+            <include refid="Condition_OutboundDetailReport"/>
+            union all
+            select
+            1
+            FROM dkic_b.t_psi_inbound as tpi
+            left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
+            Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
+            left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
+            left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = tpi.make_staff
+            left join dkic_b.t_mst_customer tmc on tmc.cus_id = tpi.cus_id
+            left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
+            left join sys.t_data_kind as tdk1 on tdk1.kind_code = tpi.into_status
+            left join sys.t_data_kind tdktype ON tdktype.kind_code = tpi.into_type
+            left join dkic_b.t_psi_inbound_item as tpii on tpii.into_id = tpi.into_id
+            left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpii.sku_id
+            left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
+            left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
+            left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
+            left join dkic_b.t_psi_inventory as tpin on tpin.inv_id = tpii.inv_id
+            left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
+            left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
+            left join dkic_b.t_mst_unit as tmgus on tmgs.sub_unit_id = tmgus.unit_id
+            <include refid="Condition_OutInboundDetailReport"/>
+        )
     </select>
     <!-- 入库明细报表主表 -->
     <select id="getInboundlReport" resultType="java.util.Map">

+ 11 - 0
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -1052,6 +1052,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
         List<Map<String, Object>> list = commonMapper.getGoodsSeries(param);
         return ResponseResultUtil.success(list);
     }
+
     /**
      * @desc :  获取计量单位不分页
      * @author : 刘尧
@@ -1061,4 +1062,14 @@ public class CommonService extends BaseService<Map<String, Object>> {
         List<Map<String, Object>> list = commonMapper.getUnit(param);
         return ResponseResultUtil.success(list);
     }
+
+    /**
+     * @desc :  获取用户授权数
+     * @author : 周兴
+     * @date : 2024/5/30 16:04
+     */
+    public ResponseResultVO<Map<String, Object>> selectUserCount(Map<String, Object> param) {
+        Map<String, Object> map = commonMapper.selectUserCount(param);
+        return ResponseResultUtil.success(map);
+    }
 }