ソースを参照

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

于继渤 2 年 前
コミット
aca79785b3

+ 24 - 0
src/main/java/com/dk/mdm/controller/mst/CustomerController.java

@@ -0,0 +1,24 @@
+package com.dk.mdm.controller.mst;
+
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.common.controller.BaseController;
+import com.dk.common.service.BaseService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mst.CustomerService;
+
+@Api(tags = "客户资料API接口")
+@RestController
+@RequestMapping("/mst/customer")
+public class CustomerController{
+
+    public BaseService<Customer> getService() {
+        return customerService;
+    }
+
+    @Autowired
+    private CustomerService customerService;
+
+}

+ 13 - 0
src/main/java/com/dk/mdm/controller/mst/MoneyAccountController.java

@@ -37,6 +37,17 @@ public class MoneyAccountController{
     }
 
     /**
+     * @desc   : 通过ID查询
+     * @author : songy
+     * @date   : 2024/3/1 16:01
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return moneyAccountService.selectById(id);
+    }
+
+
+    /**
      * @desc : 新建资金账户
      * @author : songy
      * @date : 2023/2/29 10:48
@@ -58,6 +69,8 @@ public class MoneyAccountController{
         return moneyAccountService.update(moneyAccountVO);
     }
 
+
+
     /**
      * @desc : 停用
      * @author : songy

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

@@ -2805,6 +2805,7 @@
                  left join dkic_b.t_mst_goods_series as tmgseries on tmgs.series_id = tmgseries.series_id
                  left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
         where tmgs.flg_valid
+          and tmgs.cp_id = #{cpId}
         <if test="skuCode != null">
             AND tmgs.sku_code = #{skuCode}
         </if>
@@ -2819,6 +2820,7 @@
         count(1)
         from dkic_b.t_mst_goods_sku as tmgs
         where tmgs.flg_valid
+          and tmgs.cp_id = #{cpId}
         <if test="skuCode != null">
             AND tmgs.sku_code = #{skuCode}
         </if>
@@ -2827,7 +2829,7 @@
         </if>
     </select>
 
-    <!-- 获取商品 -->
+    <!-- 获取客户 -->
     <select id="getCustomer" resultType="java.util.Map">
         select tmc.cus_id             as "cusId",
                tmc.cus_code           as "cusCode",
@@ -2865,6 +2867,7 @@
                  inner join dkic_b.t_mst_sale_channel tmsc on tmc.channel_id = tmsc.channel_id
                  left join dkic_b.t_mst_dictionary_data tmdd on tmc.cus_from = tmdd.data_id
         where tmc.flg_valid
+          and tmc.cp_id = #{cpId}
         <if test="skuCode != null">
             AND tmc.cus_code = #{cusCode}
         </if>
@@ -2879,6 +2882,7 @@
         count(1)
         from dkic_b.t_mst_customer as tmc
         where tmc.flg_valid
+          and tmc.cp_id = #{cpId}
         <if test="skuCode != null">
             AND tmc.cus_code = #{cusCode}
         </if>

+ 14 - 0
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.java

@@ -0,0 +1,14 @@
+package com.dk.mdm.mapper.mst;
+
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+*  客户资料 Mapper
+*/
+@Repository
+public interface CustomerMapper extends BaseMapper<Customer>{
+	
+}
+

+ 273 - 0
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dk.mdm.mapper.mst.CustomerMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        cus_id, cus_code, cus_name, cus_phone, address_area, address_name, address_no, address_gcj02, address_full, contact_name, contact_phone, cus_from, channel_id, org_id, staff_id, report_staff, report_time, sale_status, remarks, follow_staffs, last_follow_staff, last_follow_id, last_follow_status, last_follow_time, follow_count, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.Customer">
+        <id column="cus_id" property="cusId"/>
+                <result column="cus_code" property="cusCode"/>
+                <result column="cus_name" property="cusName"/>
+                <result column="cus_phone" property="cusPhone"/>
+                <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
+                <result column="address_name" property="addressName"/>
+                <result column="address_no" property="addressNo"/>
+                <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
+                <result column="address_full" property="addressFull"/>
+                <result column="contact_name" property="contactName"/>
+                <result column="contact_phone" property="contactPhone"/>
+                <result column="cus_from" property="cusFrom" typeHandler="UuidTypeHandler"/>
+                <result column="channel_id" property="channelId" typeHandler="UuidTypeHandler"/>
+                <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+                <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+                <result column="report_staff" property="reportStaff" typeHandler="UuidTypeHandler"/>
+            <result column="report_time" property="reportTime" typeHandler="TimestampTypeHandler"/>
+                <result column="sale_status" property="saleStatus"/>
+                <result column="remarks" property="remarks"/>
+                <result column="follow_staffs" property="followStaffs" typeHandler="UuidListTypeHandler"/>
+                <result column="last_follow_staff" property="lastFollowStaff" typeHandler="UuidTypeHandler"/>
+                <result column="last_follow_id" property="lastFollowId" typeHandler="UuidTypeHandler"/>
+                <result column="last_follow_status" property="lastFollowStatus"/>
+            <result column="last_follow_time" property="lastFollowTime" typeHandler="TimestampTypeHandler"/>
+                <result column="follow_count" property="followCount"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="cp_id" property="cpId"/>
+            <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
+            <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
+                <result column="op_app_code" property="opAppCode"/>
+            <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+                <result column="op_db_user" property="opDbUser"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="cusCode != null and cusCode != ''">
+                AND cus_code = #{cusCode}
+            </if>
+            <if test="cusName != null and cusName != ''">
+                AND cus_name = #{cusName}
+            </if>
+            <if test="cusPhone != null and cusPhone != ''">
+                AND cus_phone = #{cusPhone}
+            </if>
+            <if test="addressArea != null and addressArea != ''">
+                AND address_area = #{addressArea}
+            </if>
+            <if test="addressName != null and addressName != ''">
+                AND address_name = #{addressName}
+            </if>
+            <if test="addressNo != null and addressNo != ''">
+                AND address_no = #{addressNo}
+            </if>
+            <if test="addressGcj02 != null and addressGcj02 != ''">
+                AND address_gcj02 = #{addressGcj02}
+            </if>
+            <if test="addressFull != null and addressFull != ''">
+                AND address_full = #{addressFull}
+            </if>
+            <if test="contactName != null and contactName != ''">
+                AND contact_name = #{contactName}
+            </if>
+            <if test="contactPhone != null and contactPhone != ''">
+                AND contact_phone = #{contactPhone}
+            </if>
+            <if test="cusFrom != null and cusFrom != ''">
+                AND cus_from = #{cusFrom}
+            </if>
+            <if test="channelId != null and channelId != ''">
+                AND channel_id = #{channelId}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                AND org_id = #{orgId}
+            </if>
+            <if test="staffId != null and staffId != ''">
+                AND staff_id = #{staffId}
+            </if>
+            <if test="reportStaff != null and reportStaff != ''">
+                AND report_staff = #{reportStaff}
+            </if>
+            <if test="reportTime != null">
+                AND report_time = #{reportTime}
+            </if>
+            <if test="saleStatus != null and saleStatus != ''">
+                AND sale_status = #{saleStatus}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND remarks = #{remarks}
+            </if>
+            <if test="followStaffs != null and followStaffs != ''">
+                AND follow_staffs = #{followStaffs}
+            </if>
+            <if test="lastFollowStaff != null and lastFollowStaff != ''">
+                AND last_follow_staff = #{lastFollowStaff}
+            </if>
+            <if test="lastFollowId != null and lastFollowId != ''">
+                AND last_follow_id = #{lastFollowId}
+            </if>
+            <if test="lastFollowStatus != null and lastFollowStatus != ''">
+                AND last_follow_status = #{lastFollowStatus}
+            </if>
+            <if test="lastFollowTime != null">
+                AND last_follow_time = #{lastFollowTime}
+            </if>
+            <if test="followCount != null">
+                AND follow_count = #{followCount}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+            <if test="opCreateTime != null">
+                AND op_create_time = #{opCreateTime}
+            </if>
+            <if test="opCreateUserId != null and opCreateUserId != ''">
+                AND op_create_user_id = #{opCreateUserId}
+            </if>
+            <if test="opUpdateTime != null">
+                AND op_update_time = #{opUpdateTime}
+            </if>
+            <if test="opUpdateUserId != null and opUpdateUserId != ''">
+                AND op_update_user_id = #{opUpdateUserId}
+            </if>
+            <if test="opAppCode != null and opAppCode != ''">
+                AND op_app_code = #{opAppCode}
+            </if>
+            <if test="opTimestamp != null">
+                AND op_timestamp = #{opTimestamp}
+            </if>
+            <if test="opDbUser != null and opDbUser != ''">
+                AND op_db_user = #{opDbUser}
+            </if>
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键cusId批量操作 -->
+        WHERE cus_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_mst_customer,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_customer
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mst_customer,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM t_mst_customer
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_mst_customer的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_customer
+        WHERE cus_id = #{cusId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_mst_customer的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_customer
+        WHERE cus_id = #{cusId}
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mst_customer的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_customer
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into t_mst_customer
+        (
+        <trim suffixOverrides=",">
+            cus_code,
+            cus_name,
+            cus_phone,
+            address_area,
+            address_name,
+            address_no,
+            address_gcj02,
+            address_full,
+            contact_name,
+            contact_phone,
+            cus_from,
+            channel_id,
+            org_id,
+            staff_id,
+            report_staff,
+            report_time,
+            sale_status,
+            remarks,
+            follow_staffs,
+            last_follow_staff,
+            last_follow_id,
+            last_follow_status,
+            last_follow_time,
+            follow_count,
+            cp_id,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.cusCode},
+                #{item.cusName},
+                #{item.cusPhone},
+                #{item.addressArea},
+                #{item.addressName},
+                #{item.addressNo},
+                #{item.addressGcj02},
+                #{item.addressFull},
+                #{item.contactName},
+                #{item.contactPhone},
+                #{item.cusFrom}::uuid,
+                #{item.channelId}::uuid,
+                #{item.orgId}::uuid,
+                #{item.staffId}::uuid,
+                #{item.reportStaff}::uuid,
+                #{item.reportTime},
+                #{item.saleStatus},
+                #{item.remarks},
+                #{item.followStaffs},
+                #{item.lastFollowStaff}::uuid,
+                #{item.lastFollowId}::uuid,
+                #{item.lastFollowStatus},
+                #{item.lastFollowTime},
+                #{item.followCount},
+                #{item.cpId},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 10 - 2
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.java

@@ -2,6 +2,7 @@ package com.dk.mdm.mapper.mst;
 
 import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.GoodsBrandQuery;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.response.mst.MoneyAccountResponse;
 import org.springframework.stereotype.Repository;
@@ -16,15 +17,22 @@ public interface MoneyAccountMapper extends BaseMapper<MoneyAccount>{
     /**
      * @desc   : 根据条件进行查询
      * @author : songy
-     * @date   : 2023/1/9 10:42
+     * @date   : 2024/3/1 10:42
      */
     List<MoneyAccountResponse> selectByCond(MoneyAccountQuery moneyAccountQuery);
 
     /**
      * @desc   : 根据条件进行查询(数量)
      * @author : songy
-     * @date   : 2023/1/9 10:42
+     * @date   : 2024/3/1 10:42
      */
     Long countByCond(MoneyAccountQuery moneyAccountQuery);
+
+   /**
+    * @desc   : 查询
+    * @author : songy
+    * @date   : 2024/3/2 16:19
+    */
+    Integer selectDisplayNo(MoneyAccountQuery moneyAccountQuery);
 }
 

+ 25 - 96
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.xml

@@ -9,7 +9,7 @@
     </sql>
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.MoneyAccount">
+    <resultMap id="BaseResultMap" 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"/>
@@ -34,55 +34,37 @@
     <sql id="Condition">
         <where>
             <if test="macCode != null and macCode != ''">
-                AND mac_code = #{macCode}
+                AND ma.mac_code = #{macCode}
             </if>
             <if test="macName != null and macName != ''">
-                AND mac_name = #{macName}
-            </if>
-            <if test="macType != null and macType != ''">
-                AND mac_type = #{macType}
-            </if>
-            <if test="balance != null">
-                AND balance = #{balance}
-            </if>
-            <if test="displayNo != null">
-                AND display_no = #{displayNo}
-            </if>
-            <if test="flgDefault != null">
-                AND flg_default = #{flgDefault}
-            </if>
-            <if test="macReceiptCode != null and macReceiptCode != ''">
-                AND mac_receipt_code = #{macReceiptCode}
+                AND ma.mac_name = #{macName}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
-            </if>
-            <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND ma.remarks = #{remarks}
             </if>
             <if test="cpId != null">
-                AND cp_id = #{cpId}
+                AND ma.cp_id = #{cpId}
             </if>
             <if test="opCreateTime != null">
-                AND op_create_time = #{opCreateTime}
+                AND ma.op_create_time = #{opCreateTime}
             </if>
             <if test="opCreateUserId != null and opCreateUserId != ''">
-                AND op_create_user_id = #{opCreateUserId}
+                AND ma.op_create_user_id = #{opCreateUserId}
             </if>
             <if test="opUpdateTime != null">
-                AND op_update_time = #{opUpdateTime}
+                AND ma.op_update_time = #{opUpdateTime}
             </if>
             <if test="opUpdateUserId != null and opUpdateUserId != ''">
-                AND op_update_user_id = #{opUpdateUserId}
-            </if>
-            <if test="opAppCode != null and opAppCode != ''">
-                AND op_app_code = #{opAppCode}
+                AND ma.op_update_user_id = #{opUpdateUserId}
             </if>
             <if test="opTimestamp != null">
-                AND op_timestamp = #{opTimestamp}
+                AND ma.op_timestamp = #{opTimestamp}
             </if>
-            <if test="opDbUser != null and opDbUser != ''">
-                AND op_db_user = #{opDbUser}
+            <if test="flgValidList != null and flgValidList.size>0">
+                AND ma.flg_valid  =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+            </if>
+            <if test="macTypeList != null and macTypeList.size() > 0">
+                AND ma.mac_Type  =any(#{macTypeList, typeHandler=UuidListTypeHandler})
             </if>
         </where>
     </sql>
@@ -97,9 +79,12 @@
 
     <!-- 查询表t_mst_money_account,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
+        SELECT ma.mac_Type,ma.mac_code,ma.mac_name,ma.remarks
+             ,ma.cp_id,ma.flg_valid
+             ,dd.data_value AS "macTypeName"
+             ,ma.mac_id,ma.balance,ma.display_no
+        FROM dkic_b.t_mst_money_account ma
+        left join dkic_b.t_mst_dictionary_data dd on ma.mac_type=dd.data_id
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -110,68 +95,12 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mst_money_account
+        FROM dkic_b.t_mst_money_account ma
         <include refid="Condition"/>
     </select>
 
-    <!-- 根据主键查询表t_mst_money_account的一行数据 -->
-    <select id="selectById" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        WHERE mac_id = #{macId}::uuid
+    <select id="selectDisplayNo" resultType="Integer">
+        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_money_account ma
+         WHERE ma.cp_id = #{cpId}
     </select>
-
-    <!-- 根据主键锁定表t_mst_money_account的一行数据 -->
-    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        WHERE mac_id = #{macId}
-        for update
-    </select>
-
-    <!-- 根据主键锁定表t_mst_money_account的多行数据 -->
-    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        <include refid="idsForeach"/>
-        for update
-    </select>
-
-    <insert id="insertBatch">
-        insert into t_mst_money_account
-        (
-        <trim suffixOverrides=",">
-            mac_code,
-            mac_name,
-            mac_type,
-            balance,
-            display_no,
-            flg_default,
-            mac_receipt_code,
-            remarks,
-            cp_id,
-            op_app_code,
-        </trim>
-        )
-        values
-        <foreach collection="list" index="index" item="item" separator=",">
-            (
-            <trim suffixOverrides=",">
-                #{item.macCode},
-                #{item.macName},
-                #{item.macType}::uuid,
-                #{item.balance},
-                #{item.displayNo},
-                #{item.flgDefault},
-                #{item.macReceiptCode},
-                #{item.remarks},
-                #{item.cpId},
-                #{item.opAppCode},
-            </trim>
-            )
-        </foreach>
-    </insert>
 </mapper>

+ 1 - 0
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -141,6 +141,7 @@
         FROM dkic_b.t_psi_order_item as tpoi
                  inner join dkic_b.t_mst_goods_sku tmgs on tpoi.sku_id = tmgs.sku_id
         <include refid="Condition"/>
+        order by tpoi.item_index
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>

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

@@ -248,6 +248,7 @@
                  left join sys.t_data_kind as tdk2 on tpo.order_status = tdk2.kind_code
                  left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
         <include refid="Condition"/>
+        order by tpo.make_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>

+ 348 - 0
src/main/java/com/dk/mdm/model/pojo/mst/Customer.java

@@ -0,0 +1,348 @@
+package com.dk.mdm.model.pojo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import java.io.Serializable;
+
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.*;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.time.LocalDateTime;
+
+/**
+ *  客户资料
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户资料")
+@TableName(value = "t_mst_customer", autoResultMap = true)
+@ApiModel(value="实体类:客户资料", description="表名:t_mst_customer")
+public class Customer extends PageInfo<Customer> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+//    @TableId(value = "cus_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 客户编号
+     */
+    @Excel(name = "客户编号")
+    @ApiModelProperty(value = "客户编号")
+    private String cusCode;
+
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 客户来源 (【数据字典】)
+     */
+    @Excel(name = "客户来源 (【数据字典】)")
+    @ApiModelProperty(value = "客户来源 (【数据字典】)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusFrom;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String channelId;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 业务员
+     */
+    @Excel(name = "业务员")
+    @ApiModelProperty(value = "业务员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 报备人
+     */
+    @Excel(name = "报备人")
+    @ApiModelProperty(value = "报备人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String reportStaff;
+
+
+    /**
+     * 报备时间
+     */
+    @Excel(name = "报备时间")
+    @ApiModelProperty(value = "报备时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime reportTime;
+
+
+    /**
+     * 销售状态 (【系统字典】客销状态:公海、潜客、成交)
+     */
+    @Excel(name = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    @ApiModelProperty(value = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    private String saleStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 当前跟进人
+     */
+    @Excel(name = "当前跟进人")
+    @ApiModelProperty(value = "当前跟进人")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> followStaffs;
+
+
+    /**
+     * 最后跟进人
+     */
+    @Excel(name = "最后跟进人")
+    @ApiModelProperty(value = "最后跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

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

@@ -41,7 +41,7 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     /**
      * 资金账户ID
      */
-    @TableId(value = "mac_id", type = IdType.AUTO)
+//    @TableId(value = "mac_id", type = IdType.AUTO)
     @ApiModelProperty(value = "资金账户ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macId;
@@ -71,7 +71,6 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macType;
 
-
     /**
      * 账户余额
      */
@@ -120,6 +119,7 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     private Boolean flgValid;
 
 
+
     /**
      * 企业ID
      */

+ 1 - 1
src/main/java/com/dk/mdm/model/pojo/sale/Order.java

@@ -41,7 +41,7 @@ public class Order extends PageInfo<Order> implements Serializable {
     /**
      * 销售订单ID
      */
-    @TableId(value = "order_id", type = IdType.AUTO)
+    //@TableId(value = "order_id", type = IdType.AUTO)
     @ApiModelProperty(value = "销售订单ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String orderId;

+ 353 - 0
src/main/java/com/dk/mdm/model/query/mst/CustomerQuery.java

@@ -0,0 +1,353 @@
+package com.dk.mdm.model.query.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidListTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *  客户资料
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户资料")
+@TableName(value = "t_mst_customer", autoResultMap = true)
+@ApiModel(value="实体类:客户资料", description="表名:t_mst_customer")
+public class CustomerQuery extends PageInfo<CustomerQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+//    @TableId(value = "cus_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 客户编号
+     */
+    @Excel(name = "客户编号")
+    @ApiModelProperty(value = "客户编号")
+    private String cusCode;
+
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 客户来源 (【数据字典】)
+     */
+    @Excel(name = "客户来源 (【数据字典】)")
+    @ApiModelProperty(value = "客户来源 (【数据字典】)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusFrom;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String channelId;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 业务员
+     */
+    @Excel(name = "业务员")
+    @ApiModelProperty(value = "业务员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 报备人
+     */
+    @Excel(name = "报备人")
+    @ApiModelProperty(value = "报备人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String reportStaff;
+
+
+    /**
+     * 报备时间
+     */
+    @Excel(name = "报备时间")
+    @ApiModelProperty(value = "报备时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime reportTime;
+
+
+    /**
+     * 销售状态 (【系统字典】客销状态:公海、潜客、成交)
+     */
+    @Excel(name = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    @ApiModelProperty(value = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    private String saleStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 当前跟进人
+     */
+    @Excel(name = "当前跟进人")
+    @ApiModelProperty(value = "当前跟进人")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> followStaffs;
+
+
+    /**
+     * 最后跟进人
+     */
+    @Excel(name = "最后跟进人")
+    @ApiModelProperty(value = "最后跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 20 - 0
src/main/java/com/dk/mdm/model/query/mst/MoneyAccountQuery.java

@@ -21,6 +21,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  资金账户
@@ -193,6 +194,25 @@ public class MoneyAccountQuery extends PageInfo<MoneyAccountQuery> implements Se
     private String opDbUser;
 
 
+    /**
+     * @desc   : 有效标识List
+     * @author : songy
+     * @date   : 2024/3/2 9:31
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private List<Boolean> flgValidList;
+
+
+    /**
+     * @desc   : 账户类别list
+     * @author : songy
+     * @date   : 2024/3/2 9:27
+     */
+    @Excel(name = "账户类别 (【数据字典】)")
+    @ApiModelProperty(value = "账户类别 (【数据字典】)")
+    private List<String> macTypeList;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 353 - 0
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -0,0 +1,353 @@
+package com.dk.mdm.model.response.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidListTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *  客户资料
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户资料")
+@TableName(value = "t_mst_customer", autoResultMap = true)
+@ApiModel(value="实体类:客户资料", description="表名:t_mst_customer")
+public class CustomerResponse extends PageInfo<CustomerResponse> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+//    @TableId(value = "cus_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 客户编号
+     */
+    @Excel(name = "客户编号")
+    @ApiModelProperty(value = "客户编号")
+    private String cusCode;
+
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 客户来源 (【数据字典】)
+     */
+    @Excel(name = "客户来源 (【数据字典】)")
+    @ApiModelProperty(value = "客户来源 (【数据字典】)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusFrom;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String channelId;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 业务员
+     */
+    @Excel(name = "业务员")
+    @ApiModelProperty(value = "业务员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 报备人
+     */
+    @Excel(name = "报备人")
+    @ApiModelProperty(value = "报备人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String reportStaff;
+
+
+    /**
+     * 报备时间
+     */
+    @Excel(name = "报备时间")
+    @ApiModelProperty(value = "报备时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime reportTime;
+
+
+    /**
+     * 销售状态 (【系统字典】客销状态:公海、潜客、成交)
+     */
+    @Excel(name = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    @ApiModelProperty(value = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    private String saleStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 当前跟进人
+     */
+    @Excel(name = "当前跟进人")
+    @ApiModelProperty(value = "当前跟进人")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> followStaffs;
+
+
+    /**
+     * 最后跟进人
+     */
+    @Excel(name = "最后跟进人")
+    @ApiModelProperty(value = "最后跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 9 - 0
src/main/java/com/dk/mdm/model/response/mst/MoneyAccountResponse.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.StringListTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
@@ -21,6 +22,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  资金账户
@@ -72,6 +74,13 @@ public class MoneyAccountResponse extends PageInfo<MoneyAccountResponse> impleme
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macType;
 
+    /**
+     * 账户类别名称 (【数据字典】)
+     */
+    @Excel(name = "账户类别 (【数据字典】)")
+    @ApiModelProperty(value = "账户类别 (【数据字典】)")
+    private String macTypeName;
+
 
     /**
      * 账户余额

+ 353 - 0
src/main/java/com/dk/mdm/model/vo/mst/CustomerVO.java

@@ -0,0 +1,353 @@
+package com.dk.mdm.model.vo.mst;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidListTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *  客户资料
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("客户资料")
+@TableName(value = "t_mst_customer", autoResultMap = true)
+@ApiModel(value="实体类:客户资料", description="表名:t_mst_customer")
+public class CustomerVO extends PageInfo<CustomerVO> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 客户ID
+     */
+//    @TableId(value = "cus_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "客户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusId;
+
+
+    /**
+     * 客户编号
+     */
+    @Excel(name = "客户编号")
+    @ApiModelProperty(value = "客户编号")
+    private String cusCode;
+
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 客户来源 (【数据字典】)
+     */
+    @Excel(name = "客户来源 (【数据字典】)")
+    @ApiModelProperty(value = "客户来源 (【数据字典】)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String cusFrom;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String channelId;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 业务员
+     */
+    @Excel(name = "业务员")
+    @ApiModelProperty(value = "业务员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 报备人
+     */
+    @Excel(name = "报备人")
+    @ApiModelProperty(value = "报备人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String reportStaff;
+
+
+    /**
+     * 报备时间
+     */
+    @Excel(name = "报备时间")
+    @ApiModelProperty(value = "报备时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime reportTime;
+
+
+    /**
+     * 销售状态 (【系统字典】客销状态:公海、潜客、成交)
+     */
+    @Excel(name = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    @ApiModelProperty(value = "销售状态 (【系统字典】客销状态:公海、潜客、成交)")
+    private String saleStatus;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 当前跟进人
+     */
+    @Excel(name = "当前跟进人")
+    @ApiModelProperty(value = "当前跟进人")
+    @TableField(typeHandler = UuidListTypeHandler.class)
+    private List<String> followStaffs;
+
+
+    /**
+     * 最后跟进人
+     */
+    @Excel(name = "最后跟进人")
+    @ApiModelProperty(value = "最后跟进人")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowStaff;
+
+
+    /**
+     * 最后跟进ID
+     */
+    @Excel(name = "最后跟进ID")
+    @ApiModelProperty(value = "最后跟进ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String lastFollowId;
+
+
+    /**
+     * 最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)
+     */
+    @Excel(name = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    @ApiModelProperty(value = "最后跟进状态 (【系统字典】跟进状态:报备、跟进、邀约、报价、成交)")
+    private String lastFollowStatus;
+
+
+    /**
+     * 最后跟进时间
+     */
+    @Excel(name = "最后跟进时间")
+    @ApiModelProperty(value = "最后跟进时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime lastFollowTime;
+
+
+    /**
+     * 跟进次数
+     */
+    @Excel(name = "跟进次数")
+    @ApiModelProperty(value = "跟进次数")
+    private Integer followCount;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 14 - 1
src/main/java/com/dk/mdm/model/vo/sale/OrderVO.java

@@ -46,7 +46,7 @@ public class OrderVO extends PageInfo<OrderVO> implements Serializable {
     /**
      * 销售订单ID
      */
-    @TableId(value = "order_id", type = IdType.AUTO)
+    //@TableId(value = "order_id", type = IdType.AUTO)
     @ApiModelProperty(value = "销售订单ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String orderId;
@@ -409,6 +409,19 @@ public class OrderVO extends PageInfo<OrderVO> implements Serializable {
 
     @ApiModelProperty(value = "订单明细")
     private List<OrderItemVO> orderItemList;
+
+    @ApiModelProperty(value = "客户编号")
+    private String cusCode;
+
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+    @ApiModelProperty(value = "客户来源 (【数据字典】)")
+    private String cusFrom;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 23 - 0
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -0,0 +1,23 @@
+package com.dk.mdm.service.mst;
+
+import com.dk.mdm.model.pojo.mst.Customer;
+import com.dk.mdm.mapper.mst.CustomerMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class CustomerService extends BaseService<Customer> {
+
+	@Override
+	public BaseMapper<Customer> getRepository() {
+		return customerMapper;
+	}
+
+	@Autowired
+	private CustomerMapper customerMapper;
+
+}

+ 23 - 1
src/main/java/com/dk/mdm/service/mst/MoneyAccountService.java

@@ -2,7 +2,9 @@ package com.dk.mdm.service.mst;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.MoneyAccountConvert;
@@ -11,14 +13,19 @@ import com.dk.mdm.mapper.mst.MoneyAccountMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.mst.Staff;
+import com.dk.mdm.model.query.mst.GoodsBrandQuery;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.response.mst.MoneyAccountResponse;
 import com.dk.mdm.model.vo.mst.MoneyAccountVO;
 import com.dk.mdm.model.vo.mst.StaffVO;
+import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
 
+import java.util.Map;
 import java.util.UUID;
 
 @Service
@@ -36,6 +43,9 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	@Autowired
 	private MoneyAccountConvert moneyAccountConvert;
 
+	@Autowired
+	private CommonService commonService;
+
 	/**
 	 * @desc   : 重写主键
 	 * @author : songy
@@ -58,6 +68,7 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 				moneyAccountMapper.countByCond(moneyAccountQuery));
 	}
 
+
 	/**
 	 * @desc : 保存方法
 	 * @author : songy
@@ -69,7 +80,17 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	public ResponseResultVO<?> insert(MoneyAccountVO moneyAccountVO) {
 		// 转化实体
 		MoneyAccount moneyAccount = moneyAccountConvert.convertToPo(moneyAccountVO);
-
+		Integer displayNo = moneyAccountMapper.selectDisplayNo(new MoneyAccountQuery());
+		if (displayNo != null) {
+			//插入序号
+			moneyAccount.setDisplayNo(displayNo);
+		} else {
+			moneyAccount.setDisplayNo(0);
+		}
+		// 获取编码和主键UuId
+		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.MONEYACCOUNT.getName(),true);
+		moneyAccount.setMacId(codeMap.get("outId").toString());
+		moneyAccount.setMacCode(codeMap.get("outNote").toString());
 		return super.insert(moneyAccount);
 	}
 
@@ -87,4 +108,5 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 		return ResponseResultUtil.success(super.update(moneyAccount, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
 				UUID.fromString(moneyAccount.getMacId()))));
 	}
+
 }

+ 57 - 13
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -1,16 +1,21 @@
 package com.dk.mdm.service.sale;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.dk.common.exception.BaseBusinessException;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.sale.OrderConvert;
 import com.dk.mdm.infrastructure.convert.sale.OrderItemConvert;
 import com.dk.mdm.mapper.common.CommonMapper;
+import com.dk.mdm.mapper.mst.CustomerMapper;
 import com.dk.mdm.mapper.sale.OrderItemMapper;
 import com.dk.mdm.mapper.sale.OrderMapper;
+import com.dk.mdm.model.pojo.mst.Customer;
 import com.dk.mdm.model.pojo.sale.Order;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
@@ -21,14 +26,12 @@ import com.dk.mdm.model.response.sale.OrderItemResponse;
 import com.dk.mdm.model.response.sale.OrderResponse;
 import com.dk.mdm.model.vo.sale.OrderItemVO;
 import com.dk.mdm.model.vo.sale.OrderVO;
+import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 @Service
 @Transactional
@@ -62,7 +65,10 @@ public class OrderService extends BaseService<Order> {
     private OrderItemMapper orderItemMapper;
 
     @Autowired
-    private CommonMapper commonMapper;
+    private CommonService commonService;
+
+    @Autowired
+    private CustomerMapper customerMapper;
 
     /**
      * @desc : 条件查询
@@ -102,19 +108,57 @@ public class OrderService extends BaseService<Order> {
             rollbackFor = {Exception.class}
     )
     public ResponseResultVO<?> insertOrder(OrderVO orderVO) {
+
+        // 如果没有客户id,要新建
+        if (orderVO.getCusId() == null) {
+            List<Customer> listCustomer = customerMapper.selectByCond(new Customer().setCpId(orderVO.getCpId()).setCusPhone(orderVO.getCusPhone()));
+            // 如果客户电话已存在
+            if (listCustomer.size() > 0) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISEXISTS_CUSPHONE.getMessage());
+            }
+            // 创建客户
+            Customer customer = new Customer();
+            customer.setCusCode(orderVO.getCusCode());
+            // 获取编码和主键UuId
+            Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
+            customer.setCusId(codeMap.get("outId").toString());
+            customer.setCusCode(codeMap.get("outNote").toString());
+            customer.setCusName(orderVO.getCusName());
+            customer.setCusPhone(orderVO.getCusPhone());
+            customer.setAddressArea(orderVO.getAddressArea());
+            customer.setAddressName(orderVO.getAddressName());
+            customer.setAddressNo(orderVO.getAddressNo());
+            customer.setAddressGcj02(orderVO.getAddressGcj02());
+            customer.setAddressFull(orderVO.getAddressFull());
+            customer.setContactName(orderVO.getContactName());
+            customer.setContactPhone(orderVO.getContactPhone());
+            customer.setCusFrom(orderVO.getCusFrom());
+            customer.setChannelId(orderVO.getSalesChannel());
+            customer.setOrgId(orderVO.getOrgId());
+            customer.setStaffId(orderVO.getStaffId());
+            customer.setReportStaff(orderVO.getMakeStaff());
+            customer.setSaleStatus("销售状态-成交");
+            customer.setCpId(orderVO.getCpId());
+            customerMapper.insert(customer);
+            orderVO.setCusId(customer.getCusId());
+        }
+
+        // 获取单号
+        Map<String , Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORDER.getName(),false);
+        orderVO.setOrderId(codeMap.get("outId").toString());
+        orderVO.setOrderNo(codeMap.get("outNote").toString());
+        orderVO.setOrderType(Constant.DocumentType.ORDER_CHASE.getName());
         // 转化实体
         Order order = orderConvert.convertToPo(orderVO);
-        order.setOrderNo(UUID.randomUUID().toString());
-        order.setOrderType(Constant.DocumentType.ORDER_CHASE.getName());
         // 订单总单保存
         super.insert(order);
 
-        // 更新单号
-        Order updateOrder = new Order();
-        updateOrder.setOrderNo(commonMapper.getDocNo(order.getCpId(), order.getOrderId(), Constant.DocumentType.ORDER_CHASE.getName()));
-        updateOrder.setOrderId(order.getOrderId());
-        super.update(updateOrder,new UpdateWrapper<Order>().lambda().eq(Order::getOrderId,
-                UUID.fromString(updateOrder.getOrderId())));
+//        // 更新单号
+//        Order updateOrder = new Order();
+//        updateOrder.setOrderNo(commonMapper.getDocNo(order.getCpId(), order.getOrderId(), Constant.DocumentType.ORDER_CHASE.getName()));
+//        updateOrder.setOrderId(order.getOrderId());
+//        super.update(updateOrder,new UpdateWrapper<Order>().lambda().eq(Order::getOrderId,
+//                UUID.fromString(updateOrder.getOrderId())));
 
         // 订单明细保存
         if (orderVO.getOrderItemList() != null && orderVO.getOrderItemList().size() > 0) {