Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

zhoux 1 год назад
Родитель
Сommit
bd9d4c52aa

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

@@ -10,8 +10,8 @@
         <if test="flgValid != null">
             and flg_valid = #{flgValid}
         </if>
-        <if test="ftyId != null">
-            and fty_id = #{ftyId}
+        <if test="cpId != null">
+            and cp_id = #{cpId}
         </if>
         <if test="otherCond">
             and ${otherCond}

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml

@@ -142,7 +142,7 @@
                tmc.cus_code         as "cusCode",
                tmc.cus_name         as "cusName",
                tmc.cus_phone        as "cusPhone",
-               tmc.contact_name
+               tmc.contact_name,
                t.org_id,
                tmo.org_name         as "orgName",
                t.staff_id,

+ 2 - 1
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -109,7 +109,7 @@
         <result column="outboundNotQuantity" property="outboundNotQuantity"/>
         <result column="outboundReturnQuantity" property="outboundReturnQuantity"/>
         <result column="outboundReturnAmount" property="outboundReturnAmount"/>
-
+        <result column="receipt_lock" property="receiptLock"/>
         <result column="startAmount" property="startAmount"/>
     </resultMap>
 
@@ -313,6 +313,7 @@
         tma.receivable,
         tma.receivable_residue,
         tma.receipt_residue,
+        tma.receipt_lock,
         tmor.sum_amt_receivable AS "startAmount"
 --         concat(tms3.staff_name)  AS "followStaffsName"
         FROM dkic_b.t_mst_customer tmc

+ 2 - 0
src/main/java/com/dk/mdm/mapper/mst/DictionaryDataMapper.xml

@@ -189,6 +189,7 @@
         insert into dkic_b.t_mst_dictionary_data
         (
         <trim suffixOverrides=",">
+            data_id,
             dict_code,
             data_value,
             display_no,
@@ -204,6 +205,7 @@
         <foreach collection="list" index="index" item="item" separator=",">
             (
             <trim suffixOverrides=",">
+                #{item.dataId}::uuid,
                 #{item.dictCode},
                 #{item.dataValue},
                 #{item.displayNo},

+ 81 - 76
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.xml

@@ -5,40 +5,43 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        mac_id, mac_code, mac_name, mac_type, balance, display_no, flg_default, mac_receipt_code, acc_date, flg_negative, remarks, flg_valid, cp_id
+        mac_id
+        , mac_code, mac_name, mac_type, balance, display_no, flg_default, mac_receipt_code, acc_date, flg_negative, remarks, flg_valid, cp_id
     </sql>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.MoneyAccount">
         <id column="mac_id" property="macId"/>
-            <result column="mac_code" property="macCode"/>
-            <result column="mac_name" property="macName"/>
-            <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
-            <result column="balance" property="balance"/>
-            <result column="display_no" property="displayNo"/>
-            <result column="flg_default" property="flgDefault"/>
-            <result column="mac_receipt_code" property="macReceiptCode" typeHandler="JsonTypeHandler"/>
-            <result column="acc_date" property="accDate"/>
-            <result column="flg_negative" property="flgNegative"/>
-            <result column="remarks" property="remarks"/>
-            <result column="flg_valid" property="flgValid"/>
-            <result column="cp_id" property="cpId"/>
+        <result column="mac_code" property="macCode"/>
+        <result column="mac_name" property="macName"/>
+        <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
+        <result column="balance" property="balance"/>
+        <result column="display_no" property="displayNo"/>
+        <result column="flg_default" property="flgDefault"/>
+        <result column="mac_receipt_code" property="macReceiptCode" typeHandler="JsonTypeHandler"/>
+        <result column="acc_date" property="accDate"/>
+        <result column="flg_negative" property="flgNegative"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.MoneyAccountResponse">
         <id column="mac_id" property="macId"/>
-            <result column="mac_code" property="macCode"/>
-            <result column="mac_name" property="macName"/>
-            <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
-            <result column="balance" property="balance"/>
-            <result column="display_no" property="displayNo"/>
-            <result column="flg_default" property="flgDefault"/>
-            <result column="mac_receipt_code" property="macReceiptCode" typeHandler="JsonTypeHandler"/>
-            <result column="acc_date" property="accDate"/>
-            <result column="flg_negative" property="flgNegative"/>
-            <result column="remarks" property="remarks"/>
-            <result column="flg_valid" property="flgValid"/>
-            <result column="cp_id" property="cpId"/>
+        <result column="mac_code" property="macCode"/>
+        <result column="mac_name" property="macName"/>
+        <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
+        <result column="balance" property="balance"/>
+        <result column="display_no" property="displayNo"/>
+        <result column="flg_default" property="flgDefault"/>
+        <result column="mac_receipt_code" property="macReceiptCode" typeHandler="JsonTypeHandler"/>
+        <result column="acc_date" property="accDate"/>
+        <result column="flg_negative" property="flgNegative"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="macTypeName" property="macTypeName"/>
+
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -57,19 +60,19 @@
                 AND t.cp_id = #{cpId}
             </if>
             <if test="flgValidList != null and flgValidList.size>0">
-                AND t.flg_valid  =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+                AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
             </if>
             <if test="flgValid != null ">
-                AND t.flg_valid  = #{flgValid}
+                AND t.flg_valid = #{flgValid}
             </if>
             <if test="flgDefault != null ">
-                AND t.flg_default  = #{flgDefault}
+                AND t.flg_default = #{flgDefault}
             </if>
             <if test="macType != null">
-                AND t.mac_Type  = #{macType} ::uuid
+                AND t.mac_Type = #{macType} ::uuid
             </if>
             <if test="macTypeList != null and macTypeList.size() > 0">
-                AND t.mac_Type  =any(#{macTypeList, typeHandler=UuidListTypeHandler})
+                AND t.mac_Type =any(#{macTypeList, typeHandler=UuidListTypeHandler})
             </if>
         </where>
     </sql>
@@ -77,27 +80,28 @@
     <!-- 查询表t_mst_money_account,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT t.mac_id,
-               t.mac_code,
-               t.mac_name,
-               t.mac_Type,
-               dd.data_value             AS "macTypeName",
-               t.balance,
-               t.display_no,
-               t.mac_receipt_code,
-               t.acc_date,
-               t.flg_negative,
-               t.remarks,
-               t.flg_valid,
-               t.cp_id,
-               coalesce(tmti.amt_trf, 0) as "initBalance"
+        t.mac_code,
+        t.mac_name,
+        t.mac_Type,
+        dd.data_value AS "macTypeName",
+        t.balance,
+        t.display_no,
+        t.mac_receipt_code,
+        t.acc_date,
+        t.flg_negative,
+        t.remarks,
+        t.flg_valid,
+        t.flg_default,
+        t.cp_id,
+        coalesce(tmti.amt_trf, 0) as "initBalance"
         FROM dkic_b.t_mst_money_account as t
-                 left join dkic_b.t_mst_dictionary_data as dd on t.mac_type = dd.data_id
-                 left join(select tmti.trf_in_mac, tmti.amt_trf
-                           from dkic_b.t_mac_transfer as tmt
-                                    inner join dkic_b.t_mac_transfer_item as tmti
-                                        on tmti.trf_id = tmt.trf_id and tmt.flg_valid
-                                               and tmti.flg_valid and tmt.trf_type = 0) tmti
-                          on tmti.trf_in_mac = t.mac_id
+        left join dkic_b.t_mst_dictionary_data as dd on t.mac_type = dd.data_id
+        left join(select tmti.trf_in_mac, tmti.amt_trf
+        from dkic_b.t_mac_transfer as tmt
+        inner join dkic_b.t_mac_transfer_item as tmti
+        on tmti.trf_id = tmt.trf_id and tmt.flg_valid
+        and tmti.flg_valid and tmt.trf_type = 0) tmti
+        on tmti.trf_in_mac = t.mac_id
         <include refid="Condition"/>
         order by t.display_no
     </select>
@@ -115,7 +119,7 @@
                t.mac_code,
                t.mac_name,
                t.mac_Type,
-               dd.data_value            AS "macTypeName",
+               dd.data_value             AS "macTypeName",
                t.balance,
                t.display_no,
                t.mac_receipt_code,
@@ -146,32 +150,32 @@
         SELECT
         tmdd.data_id AS "macId",
         null AS "macType",
-        null AS  "macCode",
-        tmdd.data_value AS  "macName",
-        null	AS "Remarks",
+        null AS "macCode",
+        tmdd.data_value AS "macName",
+        null AS "Remarks",
         'true' AS "flgValid",
         null AS "macTypeName",
-        null AS  "macId",
-        null	AS "balance",
+        null AS "macId",
+        null AS "balance",
         null AS "displayNo",
         'true' AS "flgNegative",
         tmdd.cp_id
         FROM
         dkic_b.t_mst_dictionary_data tmdd
         WHERE
-        tmdd.cp_id =  #{cpId} and
+        tmdd.cp_id = #{cpId} and
         tmdd.dict_code = '基础资料-账户' UNION ALL
         SELECT
         t.mac_id AS "macId",
         t.mac_Type as "macType",
         t.mac_code AS "macCode",
         t.mac_name AS "macName",
-        t.remarks  AS "Remarks",
+        t.remarks AS "Remarks",
         t.flg_valid AS "flgValid",
         dd.data_value AS "macTypeName",
-        t.mac_id AS  "macId",
-        t.balance AS  "balance",
-        t.display_no AS  "displayNo",
+        t.mac_id AS "macId",
+        t.balance AS "balance",
+        t.display_no AS "displayNo",
         t.flg_negative as "flgNegative",
         t.cp_id
         FROM
@@ -180,9 +184,9 @@
         <include refid="Condition"/>
         ) T
         <where>
-        <if test="searchText !=null">
-            AND  T."macName"  LIKE concat('%', my_ex.likequery(#{searchText}), '%')
-        </if>
+            <if test="searchText !=null">
+                AND T."macName" LIKE concat('%', my_ex.likequery(#{searchText}), '%')
+            </if>
         </where>
     </select>
 
@@ -194,13 +198,13 @@
         (
         SELECT
         null AS "macType",
-        tmdd.data_value AS  "macCode",
-        null AS  "macName",
-        null	AS "Remarks",
+        tmdd.data_value AS "macCode",
+        null AS "macName",
+        null AS "Remarks",
         null AS "flgValid",
         null AS "macTypeName",
-        null AS  "macId",
-        null	AS "balance",
+        null AS "macId",
+        null AS "balance",
         null AS "displayNo"
         FROM
         dkic_b.t_mst_dictionary_data tmdd
@@ -210,12 +214,12 @@
         t.mac_Type as "macType",
         t.mac_code AS "macCode",
         t.mac_name AS "macName",
-        t.remarks  AS "Remarks",
+        t.remarks AS "Remarks",
         t.flg_valid AS "flgValid",
         dd.data_value AS "macTypeName",
-        t.mac_id AS  "macId",
-        t.balance AS  "balance",
-        t.display_no AS  "displayNo"
+        t.mac_id AS "macId",
+        t.balance AS "balance",
+        t.display_no AS "displayNo"
         FROM
         dkic_b.t_mst_money_account as t
         LEFT JOIN dkic_b.t_mst_dictionary_data dd ON t.mac_type = dd.data_id
@@ -223,14 +227,15 @@
         ) T
         <where>
             <if test="searchText !=null">
-                AND  T."macName"  LIKE concat('%', my_ex.likequery(#{searchText}), '%')
+                AND T."macName" LIKE concat('%', my_ex.likequery(#{searchText}), '%')
             </if>
         </where>
     </select>
 
     <select id="selectDisplayNo" resultType="Integer">
-        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_money_account t
-         WHERE t.cp_id = #{cpId}
+        SELECT MAX(display_no) + 1
+        FROM dkic_b.t_mst_money_account t
+        WHERE t.cp_id = #{cpId}
     </select>
 
     <!-- 根据主键锁定表t_mst_money_account的一行数据 -->

+ 5 - 5
src/main/java/com/dk/mdm/mapper/mst/SupplierMapper.xml

@@ -58,7 +58,7 @@ op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user,return_
         <result column="inboundAmount" property="inboundAmount"/>
         <result column="inboundNotQuantity" property="inboundNotQuantity"/>
         <result column="inboundNotAmount" property="inboundNotAmount"/>
-
+        <result column="sum_amt_payable" property="sumAmtPayable"/>
 
 
 
@@ -315,16 +315,16 @@ op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user,return_
         msl.cp_id AND tpob.flg_valid AND tpob.into_type = '入库类型-采购入库' AND tpob.into_status = '入库状态-入库中') AS
         "inboundNotAmount",
         tma.payable_residue AS "payableResidue",
-        tma.payment AS "payment"
-
-
-
+        tma.payment AS "payment",
+        tmop.sum_amt_payable
         FROM dkic_b.t_mst_supplier msl
         LEFT JOIN dkic_b.t_mst_staff  tms   ON tms.staff_id = msl.staff_id
+        LEFT JOIN dkic_b.t_mac_other_payable tmop   ON tmop.object_id = msl.sup_id and tmop.business_type = 0
         LEFT JOIN dkic_b.t_mst_org  tmo   ON tmo.org_id = msl.org_id
         LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = msl.sup_type
         LEFT JOIN dkic_b.t_mac_account tma   ON tma.object_id = msl.sup_id
         WHERE msl.sup_id = #{id}::uuid
+
     </select>
 
     <!-- 根据主键锁定表t_mst_supplier的一行数据 -->

+ 4 - 7
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -880,7 +880,7 @@
     </select>
     <!-- 采购明细报表明细 -->
     <select id="getPurDetailReport" resultType="java.util.Map">
-        select
+        select distinct
         tpp.pur_id as "purId"
         ,tpp.pur_no as "purNo"
         ,tmo.org_name as "orgName"
@@ -902,7 +902,7 @@
         ,tpp.amt_residue as "amtResidue"
         ,tpp.remarks
         ,tpo.order_no as "orderNo"
-        ,ib.into_no as "intoNo"
+        ,tpp.make_time as "makeTime"
         ,tmgs.sku_name as "skuName"
         ,tmgs.sku_model as "skuModel"
         ,tmgs.sku_spec as "skuSpec"
@@ -938,13 +938,12 @@
         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_order as tpo on tpo.order_id = tppi.from_id
-        left join dkic_b.t_psi_inbound_item as ibi on ibi.from_item_id=tppi.item_id
-        left join dkic_b.t_psi_inbound as ib on ibi.into_id=ib.into_id
+
         left join sys.t_data_kind tdk3 on tdk3.kind_code = tppi.into_status
         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_PurDetailReport"/>
-        order by tpp.op_create_time desc
+        order by tpp.make_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
@@ -966,8 +965,6 @@
         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_order as tpo on tpo.order_id = tppi.from_id
-        left join dkic_b.t_psi_inbound_item as ibi on ibi.from_item_id=tppi.item_id
-        left join dkic_b.t_psi_inbound as ib on ibi.into_id=ib.into_id
         left join sys.t_data_kind tdk3 on tdk3.kind_code = tppi.into_status
         <include refid="Condition_PurDetailReport"/>
     </select>

+ 2 - 0
src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml

@@ -257,6 +257,8 @@
             <result column="wh_name" property="whName"/>
             <result column="max_out_qty" property="maxOutQty"/>
             <result column="pack_box_text" property="packBoxText"/>
+            <result column="fact_amt" property="factAmt"/>
+            <result column="fact_price" property="factPrice"/>
     </resultMap>
     <!--小程序用 总单-->
     <sql id="Base_Column_List_Detail_Join">

+ 10 - 2
src/main/java/com/dk/mdm/model/pojo/mst/Customer.java

@@ -172,13 +172,21 @@ public class Customer extends PageInfo<Customer> implements Serializable {
     private String staffId;
 
     /**
-     * 员工名称
+     * 业务员编码
      */
     @Excel(name = "业务员编码")
-    @ApiModelProperty(value = "员工名称")
+    @ApiModelProperty(value = "业务员编码")
     @TableField(exist = false)
     private String staffCode;
 
+    /**
+     * 员工名称
+     */
+    @Excel(name = "员工名称")
+    @ApiModelProperty(value = "员工名称")
+    @TableField(exist = false)
+    private String staffName;
+
 
     /**
      * 报备人

+ 2 - 1
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -347,7 +347,8 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
 
     private String followStaffsName;
 
-
+    @ApiModelProperty(value = "总收款锁定金额 (SUM(收款+退收款)(锁定金额))")
+    private BigDecimal receiptLock;
 
 
     private static final long serialVersionUID = 1L;

+ 34 - 9
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java

@@ -203,14 +203,30 @@ public class InboundPurchaseService extends BaseService<Inbound> {
         //入库类型
         inboundVO.setIntoType(Constant.IntoType.SALE.getName());
         //自动入库标识
+//        if (inboundVO.getFlgAutoHandle()) {
+//            //已入库
+//            inboundVO.setIntoStatus(Constant.IntoStatus.YIRUKU.getName());
+//            //入库日期
+//            inboundVO.setIntoDate(inboundVO.getIntoDate() == null ? LocalDate.now() : inboundVO.getIntoDate());
+//        } else {
+//            //入库中
+//            inboundVO.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
+//        }
         if (inboundVO.getFlgAutoHandle()) {
+            if (inboundVO.getInboundProcessingFlag()) {
+                //已入库
+                inboundVO.setIntoStatus(Constant.IntoStatus.YIRUKU.getName());
+                //入库日期
+                inboundVO.setIntoDate(inboundVO.getIntoDate() == null ? LocalDate.now() : inboundVO.getIntoDate());
+            } else {
+                //入库中
+                inboundVO.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
+            }
+        } else {
             //已入库
             inboundVO.setIntoStatus(Constant.IntoStatus.YIRUKU.getName());
             //入库日期
             inboundVO.setIntoDate(inboundVO.getIntoDate() == null ? LocalDate.now() : inboundVO.getIntoDate());
-        } else {
-            //入库中
-            inboundVO.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
         }
         //入库状态等于已入库 更新合计入库数量/金额 = 入库中数量/入库中金额
         if (Constant.IntoStatus.YIRUKU.getName().equals(inboundVO.getIntoStatus())) {
@@ -229,8 +245,11 @@ public class InboundPurchaseService extends BaseService<Inbound> {
         inboundMapper.insert(inbound);
         //endregion
 
-        //region 采购总单
-        this.insertOrderMessageByEdit(inboundVO, inboundVO.getItemList());
+        if (inboundVO.getFromId() != null) {
+            //region 采购总单
+            this.insertOrderMessageByEdit(inboundVO, inboundVO.getItemList());
+        }
+
         //endregion
 
         //region 明细
@@ -1423,8 +1442,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                 purchase.setPurId(fromId);
                 purchase.setIntoQty(purchaseSumQty);
                 purchase.setIntoAmt(purchaseSumAmt);
-                purchase.setIntoingAmt(updatePurchaseIntoingQty.negate());
-                purchase.setIntoingQty(updatePurchaseIntoingAmt.negate());
+                purchase.setIntoingAmt(updatePurchaseIntoingAmt.negate());
+                purchase.setIntoingQty(updatePurchaseIntoingQty.negate());
                 //入库状态
                 String purIntoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchase.getIntoingQty()),
                         purchaseResponse.getIntoQty().add(purchase.getIntoQty()), purchaseResponse.getSumQuantity());
@@ -1792,8 +1811,14 @@ public class InboundPurchaseService extends BaseService<Inbound> {
         }
         //已入库 数量>0 入库中数量=0
         else if (intoQty.compareTo(BigDecimal.ZERO) > 0 && intoingQty.compareTo(BigDecimal.ZERO) == 0) {
-            //已入库
-            intoStatus = Constant.IntoStatus.YIRUKU.getName();
+            if (sumQty.compareTo(intoQty.add(intoingQty)) == 0) {
+                //已入库
+                intoStatus = Constant.IntoStatus.YIRUKU.getName();
+            } else {
+                //入库中
+                intoStatus = Constant.IntoStatus.RUKUZHONG.getName();
+            }
+
         }
         return intoStatus;
     }

+ 6 - 2
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -1,5 +1,6 @@
 package com.dk.mdm.service.ivt.outbound;
 
+import com.alibaba.nacos.client.naming.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.dk.common.exception.BaseBusinessException;
 import com.dk.common.infrastructure.annotaiton.Pagination;
@@ -1689,7 +1690,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
 
         return ResponseResultUtil.success(outboundVO);
     }
-
     /**
      * @desc : 办理销售出库修改销售订单信息
      * @date : 2024/6/21 15:13
@@ -1700,7 +1700,11 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
         //出库明细汇总
         Map<String, List<OutboundItemVO>> orderOutItemVOListMap = itemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getFromId));
         //出库明细删除汇总
-        Map<String, List<OutboundItemVO>> delOrderOutItemVOListMap = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getFromId));
+        Map<String, List<OutboundItemVO>> delOrderOutItemVOListMap = null;
+        if(!CollectionUtils.isEmpty(deleteItemList)){
+            delOrderOutItemVOListMap =
+                    deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getFromId));
+        }
         //出库明细汇总循环
         for (String fromId : orderOutItemVOListMap.keySet()) {
             //有需要删除的办理数据

+ 3 - 1
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -802,7 +802,7 @@ public class ReceiptService extends BaseService<RecPay> {
                         .setStaffId(recPayVO.getStaffId())
                         .setAccDate(recPayVO.getAccDate())
                         .setRecStatus(Constant.recStatuse.QUE_DING.getName())
-                        .setAmtPay(recPayItem.getAmtRec())
+                        .setAmtPay(recPayItem.getAmtPay())
                         .setBiznisType("t_mac_rec_pay_item")
                         .setBiznisId(recPayItem.getRpId())
                         .setBiznisNo(recPayVO.getRpNo())
@@ -839,6 +839,8 @@ public class ReceiptService extends BaseService<RecPay> {
                 .setObjectId(accountForUpdate.getObjectId());
         accountService.updateByUuid(accountUpdate);
         return ResponseResultUtil.success();
+
+
     }
 
 

+ 2 - 2
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -340,7 +340,7 @@ public class CusFollowService extends BaseService<CusFollow> {
      * @date : 2022-06-29 14:22
      */
     @Transactional(rollbackFor = {Exception.class})
-    @XxlJob("customer-reminder")
+//    @XxlJob("customer-reminder")
     public ResponseResultVO customerReminder() {
         log.info("@XxlJob(\"customer-reminder\")");
         log.info("followPlan id: {}", XxlJobHelper.getJobParam());
@@ -384,7 +384,7 @@ public class CusFollowService extends BaseService<CusFollow> {
      * @date : 2022-06-29 14:22
      */
     @Transactional(rollbackFor = {Exception.class})
-    @XxlJob("plan-reminder")
+//    @XxlJob("plan-reminder")
     public void planReminder() {
         log.info("@XxlJob(\"plan-reminder\")");
         log.info("followPlan id: {}", XxlJobHelper.getJobParam());

+ 46 - 31
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -25,11 +25,13 @@ import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.query.ivt.InboundItemQuery;
 import com.dk.mdm.model.query.mst.ComMenuQuery;
+import com.dk.mdm.model.query.mst.DictionaryDataQuery;
 import com.dk.mdm.model.query.mst.GoodsCategoryQuery;
 import com.dk.mdm.model.query.mst.StaffQuery;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.vo.mst.StaffVO;
 import com.dk.mdm.model.response.mst.ComMenuResponse;
+import com.dk.mdm.model.response.mst.DictionaryDataResponse;
 import com.dk.mdm.model.vo.mst.ComMenuVO;
 import com.dk.mdm.service.common.CommonService;
 import lombok.extern.slf4j.Slf4j;
@@ -216,14 +218,14 @@ public class StaffService extends BaseService<Staff> {
                         ErrorCodeEnum.USER_REGISTER_ERROR.getMessage());
             } else {
                 Map<String, Object> mp = (Map<String, Object>) resultMaxnum.getData();
-                int intWebMaxnum =0;
-                if(mp.get("web_max_num") != null ){
-                    intWebMaxnum =  Integer.parseInt(mp.get("web_max_num") + "");
+                int intWebMaxnum = 0;
+                if (mp.get("web_max_num") != null) {
+                    intWebMaxnum = Integer.parseInt(mp.get("web_max_num") + "");
                 }
 
                 int intWxMaxnum = 0;
-                if(mp.get("wx_max_num") != null ){
-                    intWxMaxnum =  Integer.parseInt(mp.get("wx_max_num") + "");
+                if (mp.get("wx_max_num") != null) {
+                    intWxMaxnum = Integer.parseInt(mp.get("wx_max_num") + "");
                 }
                 staffQuery = new StaffQuery();
                 staffQuery.setFlgCanLogin(true);
@@ -418,7 +420,7 @@ public class StaffService extends BaseService<Staff> {
                 role.setFlgNolimitFun(true);
                 role.setFlgNolimitPvw(true);
                 role.setFlgNolimitSen(true);
-            }else{
+            } else {
                 role.setFlgNolimitFun(false);
                 role.setFlgNolimitPvw(false);
                 role.setFlgNolimitSen(false);
@@ -480,6 +482,9 @@ public class StaffService extends BaseService<Staff> {
             for (int i = 0; i < listDictionaryDatas.size(); i++) {
                 Map<String, Object> m = listDictionaryDatas.get(i);
                 DictionaryData dictionaryData = new DictionaryData();
+//                Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.DICTIONARYDATA.getName(),cpId, true);
+//                // 获取编码和主键UuId  codeMap.get("outId").toString()
+                dictionaryData.setDataId(UUID.randomUUID().toString());
                 dictionaryData.setDictCode(m.get("dictCode").toString());
                 dictionaryData.setDataCode(m.get("dataCode").toString());
                 dictionaryData.setDataValue(m.get("dataValue").toString());
@@ -501,8 +506,18 @@ public class StaffService extends BaseService<Staff> {
                 MoneyAccount moneyAccount = new MoneyAccount();
                 moneyAccount.setMacCode(m.get("macCode").toString());
                 moneyAccount.setMacName(m.get("macName").toString());
-                moneyAccount.setMacType(m.get("macType").toString());
-                moneyAccount.setAccDate(LocalDate.parse(m.get("accDate").toString()));
+//               从上面数据字典中查询 新的id 240814
+                List<DictionaryData> dictionaryDatas = listDD.stream().filter(it ->
+                        "基础资料-账户".equals(it.getDictCode()) && (m.get("macName") + "").equals(it.getDataValue())
+                ).collect(Collectors.toList());
+
+                if (dictionaryDatas != null && dictionaryDatas.size() > 0) {
+                    moneyAccount.setMacType(dictionaryDatas.get(0).getDataId());
+                } else {
+                    // 该值不正确  要清洗数据
+                    moneyAccount.setMacType(m.get("macType").toString());
+                }
+                moneyAccount.setAccDate(LocalDate.now());
 //                moneyAccount.setBalance((BigDecimal) m.get("balance"));
                 moneyAccount.setBalance(new BigDecimal(m.get("balance").toString()));
                 moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
@@ -556,7 +571,7 @@ public class StaffService extends BaseService<Staff> {
                 goodsCategoryMapper.insert(goodsCategory);
                 listG = new ArrayList<>();
                 // 插入子级
-                for(Map<String, Object> c : childList){
+                for (Map<String, Object> c : childList) {
                     GoodsCategory gc = new GoodsCategory();
                     gc.setCatCode(c.get("catCode") + "");
                     gc.setCatName(c.get("catName") + "");
@@ -566,8 +581,9 @@ public class StaffService extends BaseService<Staff> {
                     gc.setCpId(cpId);
                     gc.setOpCreateUserId(staffId);
                     listG.add(gc);
-                };
-                if(listG != null && listG.size() > 0){
+                }
+                ;
+                if (listG != null && listG.size() > 0) {
                     goodsCategoryMapper.insertBatch(listG);
                 }
             }
@@ -676,14 +692,14 @@ public class StaffService extends BaseService<Staff> {
             } else {
                 if (staffResponseOld.getFlgCanLogin() != staffVO.getFlgCanLogin()) {
                     Map<String, Object> mp = (Map<String, Object>) resultMaxnum.getData();
-                    int intWebMaxnum =0;
-                    if(mp.get("web_max_num") != null ){
-                        intWebMaxnum =  Integer.parseInt(mp.get("web_max_num") + "");
+                    int intWebMaxnum = 0;
+                    if (mp.get("web_max_num") != null) {
+                        intWebMaxnum = Integer.parseInt(mp.get("web_max_num") + "");
                     }
 
                     int intWxMaxnum = 0;
-                    if(mp.get("wx_max_num") != null ){
-                        intWxMaxnum =  Integer.parseInt(mp.get("wx_max_num") + "");
+                    if (mp.get("wx_max_num") != null) {
+                        intWxMaxnum = Integer.parseInt(mp.get("wx_max_num") + "");
                     }
                     StaffQuery staffQueryf = new StaffQuery();
                     staffQueryf.setFlgCanLogin(true);
@@ -748,7 +764,7 @@ public class StaffService extends BaseService<Staff> {
      * @author : 姜永辉
      * @date : 2023/1/9 10:49
      */
-    @Transactional(rollbackFor = {Exception.class} )
+    @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<Boolean> updateFeignStaffFlgCanLogin(List<String> list) {
         //  FlgCanLogin  登录系统(1:PC端,2:移动端,3:PC+移动端, 4:无)
         staffMapper.updateFeignStaffFlgCanLogin(list);
@@ -915,9 +931,9 @@ public class StaffService extends BaseService<Staff> {
 
 
     /**
-     * @desc   : 生成幽灵标识的数据
+     * @desc : 生成幽灵标识的数据
      * @author : 常皓宁
-     * @date   : 2024/6/19 10:53
+     * @date : 2024/6/19 10:53
      */
     @Transactional(
             rollbackFor = {Exception.class}
@@ -930,9 +946,9 @@ public class StaffService extends BaseService<Staff> {
         staffQuery.setCpId(staff.getCpId());
         List<StaffResponse> staffResponses = staffMapper.selectByCond(staffQuery);
         if (staffResponses == null || staffResponses.size() == 0) {
-            return ResponseResultUtil.error(-200,"绑定员工不存在");
-        }else {
-            for (StaffResponse staffResponse:staffResponses){
+            return ResponseResultUtil.error(-200, "绑定员工不存在");
+        } else {
+            for (StaffResponse staffResponse : staffResponses) {
                 // 获取编码和主键UuId
                 Map<String, Object> codeMap = commonService.getUniqueNoteCode(
                         Constant.docNameConstant.STAFF.getName(), staff.getCpId(), true);
@@ -955,9 +971,9 @@ public class StaffService extends BaseService<Staff> {
     }
 
     /**
-     * @desc   : 删除幽灵标识数据
+     * @desc : 删除幽灵标识数据
      * @author : 常皓宁
-     * @date   : 2024/6/19 10:53
+     * @date : 2024/6/19 10:53
      */
     @Transactional(
             rollbackFor = {Exception.class}
@@ -970,22 +986,21 @@ public class StaffService extends BaseService<Staff> {
         staffQuery.setStaffPhone(staff.getStaffPhone());
         staffQuery.setCpId(staff.getCpId());
         int a = staffMapper.deleteGhostStaff(staffQuery);
-        if (a > 0){
+        if (a > 0) {
             return ResponseResultUtil.success();
-        }
-        else{
-            return ResponseResultUtil.error(-200,"绑定员工不存在");
+        } else {
+            return ResponseResultUtil.error(-200, "绑定员工不存在");
         }
     }
 
     /**
-     * @desc   : 更新负责人标识
+     * @desc : 更新负责人标识
      * @author : 刘尧
-     * @date   : 2024/6/21 16:24
+     * @date : 2024/6/21 16:24
      */
     public ResponseResultVO updateFlgInit(Map<String, Object> params) {
         boolean updateBool = staffMapper.updateFlgInit(params);
-        if (updateBool){
+        if (updateBool) {
             updateBool = staffMapper.updateFlgInitById(String.valueOf(params.get("owner")));
             return ResponseResultUtil.success(updateBool);
         }

+ 353 - 0
src/main/java/com/dk/mdm/service/xxl/XxlService.java

@@ -0,0 +1,353 @@
+package com.dk.mdm.service.xxl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.xxl.XxlJobUtils;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.common.model.response.mst.StaffResponse;
+import com.dk.common.response.ResponseCodeEnum;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.common.service.BaseService;
+import com.dk.common.util.HttpUtils;
+import com.dk.mdm.feign.UserFeign;
+import com.dk.mdm.infrastructure.config.Config;
+import com.dk.mdm.mapper.mst.CusFollowMapper;
+import com.dk.mdm.mapper.mst.CustomerMapper;
+import com.dk.mdm.mapper.mst.FollowPlanMapper;
+import com.dk.mdm.mapper.mst.StaffMapper;
+import com.dk.mdm.model.pojo.mst.CusFollow;
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.mdm.model.pojo.mst.FollowPlan;
+import com.dk.mdm.model.query.mst.CustomerQuery;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+@Slf4j
+@Service
+public class XxlService extends BaseService<CusFollow> {
+    @Override
+    public BaseMapper<CusFollow> getRepository() {
+        return cusFollowMapper;
+    }
+
+    @Autowired
+    private CustomerMapper customerMapper;
+    @Autowired
+    private StaffMapper staffMapper;
+    @Autowired
+    private CusFollowMapper cusFollowMapper;
+    @Autowired
+    private FollowPlanMapper followPlanMapper;
+    @Autowired
+    private XxlJobUtils xxlJobUtils;
+    @Autowired
+    private Config config;
+    @Resource
+    private UserFeign userFeign;
+
+    /**
+     * @desc : 客户跟进提醒回调
+     * @author : 姜永辉
+     * @date : 2022-06-29 14:22
+     */
+    @Transactional(rollbackFor = {Exception.class})
+    @XxlJob("customer-reminder")
+    public ResponseResultVO customerReminder() {
+        log.info("@XxlJob(\"customer-reminder\")");
+        log.info("followPlan id: {}", XxlJobHelper.getJobParam());
+//        String planid = "10112024-0715-0000-0000-0004a8b4d1e6";
+        FollowPlan followPlan = followPlanMapper.selectById(XxlJobHelper.getJobParam());
+        if (followPlan != null) {
+            CusFollow follow = cusFollowMapper.selectById(followPlan.getFollowId());
+            if (follow != null) {
+                FollowPlan plan = new FollowPlan().setPlanId(followPlan.getPlanId());
+                try {
+                    //发消息
+                    String msg = sendFollowMessage(follow, followPlan);
+                    if (msg == null) {
+                        plan.setCallStatus(Constant.CallStatus.CALL_STATUS_DONE.getName() + "");
+                    } else {
+                        plan.setCallStatus(Constant.CallStatus.CALL_STATUS_ERROR.getName() + "").setRemarks(msg);
+                    }
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    log.error("客户跟进发送消息异常:{}", e.getMessage());
+                    plan.setCallStatus(Constant.CallStatus.CALL_STATUS_ERROR.getName() + "").setRemarks(e.getMessage());
+                }
+
+                //修改状态
+                followPlanMapper.update(plan,
+                        new UpdateWrapper<FollowPlan>().lambda()
+                                .eq(FollowPlan::getPlanId, UUID.fromString(plan.getPlanId())));
+
+                //删除任务
+                xxlJobUtils.delete(followPlan.getXxlJobId());
+            }
+
+        }
+        return null;
+    }
+
+    /**
+     * @desc : 客户计划任务提醒回调
+     * @author : jyh
+     * @date : 2022-06-29 14:22
+     */
+    @Transactional(rollbackFor = {Exception.class})
+    @XxlJob("plan-reminder")
+    public void planReminder() {
+        log.info("@XxlJob(\"plan-reminder\")");
+        log.info("followPlan id: {}", XxlJobHelper.getJobParam());
+//        String planid = "10112024-0715-0000-0000-0004a8b4d1e6";
+        FollowPlan followPlan = followPlanMapper.selectById(XxlJobHelper.getJobParam());
+        if (followPlan != null && followPlan.getFlgValid()) {
+            FollowPlan plan = new FollowPlan().setPlanId(followPlan.getPlanId());
+            try {
+                //发消息
+                String msg = sendFollowPlanMessage(followPlan);
+                if (msg == null) {
+                    plan.setCallStatus(Constant.CallStatus.CALL_STATUS_DONE.getName() + "");
+                } else {
+                    plan.setCallStatus(Constant.CallStatus.CALL_STATUS_ERROR.getName() + "").setRemarks(msg);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("跟进任务发送消息异常:{}", e.getMessage());
+                plan.setCallStatus(Constant.CallStatus.CALL_STATUS_ERROR.getName() + "").setRemarks(e.getMessage());
+            }
+            //修改状态
+            followPlanMapper.updateById(plan);
+            //删除任务
+            xxlJobUtils.delete(followPlan.getXxlJobId());
+
+        }
+    }
+
+    /**
+     * @desc : 发送跟进任务消息
+     * @author : 姜永辉
+     * @date : 2022-06-30 19:24
+     */
+    public String sendFollowPlanMessage(FollowPlan followPlan) {
+        log.info("sendFollowMessage:{}", JSONObject.toJSONString(followPlan));
+        // 跟进人
+        StaffResponse followStaff = staffMapper.selectById(followPlan.getFollowUser());
+
+        Customer customer = customerMapper.selectById(new CustomerQuery().setCusId(followPlan.getCusId()));
+
+        if (customer != null) {
+            // 小程序消息
+
+
+            return null;
+        } else {
+            return ResponseCodeEnum.SELECT_NULL.getMessage();
+        }
+    }
+
+    /**
+     * @desc : 发送跟进消息
+     * @author : 姜永辉
+     * @date : 2022-05-27 09:34
+     */
+    public String sendFollowMessage(CusFollow follow, FollowPlan followPlan) {
+        log.info("sendFollowMessage:{}", JSONObject.toJSONString(follow));
+        // 跟进人
+        StaffResponse followStaff = null;
+        // 当跟进计划状态为跟尺时 获取设计师信息
+        if (follow.getFollowStatus().equals("跟进状态-约尺")) {
+            followStaff = staffMapper.selectById(follow.getDesignStaff());
+        } else {
+            followStaff = staffMapper.selectById(followPlan.getFollowUser());
+        }
+        //查到跟进人
+        if (followStaff != null) {
+            log.info("sendFollowMessage:{}", JSONObject.toJSONString(followStaff));
+            Customer customer = customerMapper.selectById(follow.getCusId());
+            log.info("customer:{}", JSONObject.toJSONString(customer));
+            Map<String, Object> otherParamMap = new HashMap<>();
+            if (customer != null) {
+                if (follow.getFollowStatus().equals("跟进状态-约尺")) {
+//                    customer.setStaffName(followStaff.getStaffName());
+//                    // 暂时用最后一次 跟进id传过去
+//                    customer.setLastFollowId(follow.getFollowId());
+                    otherParamMap.put("staffName", followStaff.getStaffName());
+                    otherParamMap.put("staffId", followStaff.getStaffId());
+                    otherParamMap.put("followId", follow.getFollowId());
+                }
+                String loginType = "4";
+//                List<String> list = new ArrayList<>();
+                Map<String, String> keywordMap = new HashMap<>();
+                if (Constant.BasicDataConstant.FOLLOW_STATUS_4.getValue().equals(follow.getFollowStatus()) ||
+                        Constant.BasicDataConstant.FOLLOW_STATUS_1.getValue().equals(follow.getFollowStatus()) ||
+                        Constant.BasicDataConstant.FOLLOW_STATUS_5.getValue().equals(follow.getFollowStatus())) {
+//                    list.add("您有客户需要跟进");
+                    keywordMap.put("remark", "您有客户需要跟进");
+                    loginType = "4";
+
+                } else if (Constant.BasicDataConstant.FOLLOW_STATUS_6.getValue().equals(follow.getFollowStatus())) {
+//                    list.add("您有客户需要量尺服务");
+                    keywordMap.put("remark", "您有客户需要量尺服务");
+                    loginType = "6";
+
+                } else if (Constant.BasicDataConstant.FOLLOW_STATUS_2.getValue().equals(follow.getFollowStatus())) {
+//                    list.add("您有客户邀约进店");
+                    keywordMap.put("remark", "您有客户邀约进店");
+                    loginType = "2";
+
+                } else if (Constant.BasicDataConstant.FOLLOW_STATUS_3.getValue().equals(follow.getFollowStatus())) {
+//                    list.add("您有客户需要约尺服务");
+                    keywordMap.put("remark", "您有客户需要约尺服务");
+                    loginType = "3";
+                }
+//                list.add(customer.getCusName());
+//                list.add(customer.getCusPhone());
+                LocalDateTime followTime = follow.getFollowTime();
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+                keywordMap.put("cusName", customer.getCusName());
+                keywordMap.put("cusPhone", customer.getCusPhone());
+                keywordMap.put("followTime", followTime.format(formatter));
+                // 查询跟进人的openid和publicOpenId   7.19 加了userWxId 刘尧
+                ResponseResultVO<?> resultVO = userFeign.getUser(followStaff.getWxUserId());
+                // 如果没有成功返回,状态设置为待审
+                if (resultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
+                    log.error("客户查询异常:为空{}", follow.getCusId());
+                    return ResponseCodeEnum.SELECT_NULL.getMessage();
+                } else {
+                    Map<String, Object> user = (Map<String, Object>) resultVO.getData();
+                    if (user != null) {
+                        // 发送消息
+                        Map<String, Object> mapMessage = new HashMap<>();
+                        mapMessage.put("loginType", loginType);
+                        otherParamMap.put("cusId", customer.getCusId());
+                        mapMessage.put("otherParam", JSONObject.toJSONString(otherParamMap));
+//                        mapMessage.put("publicOpenId", user.get("publicOpenId"));
+                        mapMessage.put("userWxId", user.get("userWxId"));
+                        mapMessage.put("first", "客户跟进提醒");
+//                      mapMessage.put("keywordList", list);
+//                      mapMessage.put("keywordMap", keywordMap);
+                        mapMessage.put("remark", "客户跟进备注");
+//                      sendUniformMessage(mapMessage);
+                        List<String> miniMessageModelIds = config.getMiniMessageModelIds();
+                        // 构造对应的显示信息 和模板数据结构对应
+                        JSONObject data = new JSONObject();
+                        data.put("time4", createDataItem("value", String.valueOf(keywordMap.get("followTime"))));
+                        data.put("thing1", createDataItem("value", String.valueOf(keywordMap.get("cusName"))));
+                        data.put("phone_number2", createDataItem("value", String.valueOf(keywordMap.get("cusPhone"))));
+                        data.put("thing6", createDataItem("value", String.valueOf(keywordMap.get("remark"))));
+                        data.put("thing5", createDataItem("value", String.valueOf(mapMessage.get("remark"))));
+                        wxMessagePush(miniMessageModelIds.get(0), data, mapMessage);
+                    }
+                }
+
+                return null;
+            } else {
+                log.error("客户查询异常:为空{}", follow.getCusId());
+                return ResponseCodeEnum.SELECT_NULL.getMessage();
+            }
+        } else {
+            log.error("跟进人异常:为空{}", followPlan.getFollowUser());
+            return ResponseCodeEnum.SELECT_NULL.getMessage();
+        }
+
+    }
+
+    /**
+     * @desc : 构造消息推送模板中data值
+     * @author : 刘尧
+     * @date : 2024-07-19 08:56
+     */
+    private static Map<String, Object> createDataItem(String name, String value) {
+        Map<String, Object> item = new HashMap<>();
+        item.put(name, value);
+        return item;
+    }
+
+
+    /**
+     * @desc : 向用户推送小程序订阅消息方法
+     * @author : 刘尧
+     * @date : 2024-07-19 08:56
+     */
+    public ResponseResultVO<?> wxMessagePush(String messId, JSONObject data, Map<String, Object> map) {
+        // 获取微信Token
+        String wxToken = getWxToken();
+        Map<String, Object> params = new HashMap<>();
+        // 接口调用凭证
+        params.put("access_token", wxToken);
+        // 所需下发的订阅模板id
+        params.put("template_id", messId);
+        // 点击模板卡片后的跳转页面
+        if (map.containsKey("otherParam")) {
+            params.put("page", "pages/welcome/welcome?loginType=" + map.get("loginType").toString() + "&otherParam=" + map.get("otherParam").toString());
+        } else {
+            params.put("page", "pages/welcome/welcome?loginType=" + map.get("loginType").toString());
+        }
+        // 接收者(用户)的 openid
+        params.put("touser", map.get("userWxId"));
+        // 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;
+        params.put("miniprogram_state", "trial");
+        // 配置模板中明细值
+        params.put("data", data);
+
+        ResponseResultVO<JSONObject> post = HttpUtils.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + wxToken, params);
+        return post;
+    }
+
+    /**
+     * @desc : 获取微信小程序后台Token
+     * @author : 刘尧
+     * @date : 2024-07-19 08:56
+     */
+    private String getWxToken() {
+        String appId = config.getAppId();
+        String appSecret = config.getAppSecret();
+        ResponseResultVO<JSONObject> tokenRes = HttpUtils.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret);
+        JSONObject data = tokenRes.getData();
+        return String.valueOf(data.get("access_token"));
+    }
+
+    /**
+     * @desc : 将字节转化为十六进制字符串
+     * @author : 刘尧
+     * @date : 2024-07-19 08:56
+     */
+    private static String byteToStr(byte[] byteArray) {
+        String strDigest = "";
+        for (int i = 0; i < byteArray.length; i++) {
+            strDigest += byteToHexStr(byteArray[i]);
+        }
+        return strDigest;
+    }
+
+    /**
+     * @desc : 将字节转换成对应的两位十六进制字符串
+     * @author : 刘尧
+     * @date : 2024-07-19 08:56
+     */
+    private static String byteToHexStr(byte mByte) {
+        char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
+                'B', 'C', 'D', 'E', 'F'};
+        char[] tempArr = new char[2];
+        tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
+        tempArr[1] = Digit[mByte & 0X0F];
+        String s = new String(tempArr);
+        return s;
+    }
+
+}

+ 2 - 2
src/main/resources/test/bootstrap.yml

@@ -92,8 +92,8 @@ swagger:
 wx:
   code2Session: https://qyapi.weixin.qq.com/cgi-bin/miniprogram/jscode2session?
   accessToken: https://qyapi.weixin.qq.com/cgi-bin/gettoken?
-  appId: wx414cffd0fc05e151
-  appSecret: 868ec372b9da961eb42989559bc9ccc5
+  appId: wxe27c8f5249b7aeab
+  appSecret: 9bd0efa102f148ff4ca09a1152310555
   apiUrl: https://api.weixin.qq.com/sns/jscode2session?
   #  企信企业id
   corpid: ww796c5d1684937b2f