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

Merge remote-tracking branch 'origin/master'

姜永辉 2 лет назад
Родитель
Сommit
da2fb23c27

+ 24 - 9
src/main/java/com/dk/mdm/infrastructure/util/AuthUtils.java

@@ -17,6 +17,9 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -64,20 +67,20 @@ public class AuthUtils {
         try {
             String[] tokens = token.split(" ");
             String decrypt = AESSecurityUtil.decrypt(AESKey, tokens[1]);
-            String staffId = JwtUtil.getStaffId(decrypt);
-            log.info("staffId=>{}",staffId);
-
+            String userId = JwtUtil.getUserId(decrypt);
+            log.info("staffId=>{}",userId);
             String appCode = JwtUtil.getAppCode(decrypt);
             log.info("appCode=>{}",appCode);
             String cpId = JwtUtil.getCpId(decrypt);
             log.info("cpId=>{}",cpId);
             String cpCode = JwtUtil.getCpCode(decrypt);
             log.info("cpCode=>{}",cpCode);
-            String json = stringRedisTemplate.opsForValue().get(Constant.RedisConstant.REDIS_STAFF.getName() + cpId + Constant.StringConstant.SYSTEM_MAGIN_LINE.getName() + appCode + Constant.StringConstant.SYSTEM_MAGIN_LINE.getName() + staffId);
+            String key = Constant.RedisConstant.REDIS_USER_LOGIN.getName() + '_' + userId + '_' + appCode;
+            String json = stringRedisTemplate.opsForValue().get(key);
             if (json==null){
-                return saveStaff(staffId, cpCode, appCode);
+                return null;
             }else{
-                return JSONObject.parseObject(json, StaffEntity.class);
+                return JSONObject.parseObject(JSONObject.toJSONString(JSONObject.parseObject(json)), StaffEntity.class);
             }
         } catch (Exception e) {
             log.error(e.toString(),e);
@@ -149,9 +152,21 @@ public class AuthUtils {
      * @date   : 2023/1/6 15:18
      */
     public StaffEntity saveStaff(StaffEntity staff){
-        if (staff!=null) {
-            stringRedisTemplate.opsForValue().set(Constant.RedisConstant.REDIS_STAFF.getName() + staff.getCpId() + Constant.StringConstant.SYSTEM_MAGIN_LINE.getName()
-                    + staff.getAppCode() + Constant.StringConstant.SYSTEM_MAGIN_LINE.getName() + staff.getStaffCode(), JSONObject.toJSONString(staff), 1, TimeUnit.HOURS);
+        if(staff != null ){
+            String userId = staff.getWxUserId();
+            String appCode = staff.getAppCode();
+            String key = Constant.RedisConstant.REDIS_USER_LOGIN.getName() + '_' + userId + '_' + appCode;
+            String mapStr = stringRedisTemplate.opsForValue().get(key);
+            Map<String,Object> userMap = JSONObject.parseObject(mapStr);
+            if (userMap != null) {
+                userMap.put("staffId",staff.getStaffId());
+                userMap.put("staffCode",staff.getStaffCode());
+                userMap.put("cpId",staff.getCpId());
+                userMap.put("cpCode",staff.getCpCode());
+                userMap.put("orgId",staff.getOrgId());
+                userMap.put("opUpdateTime",LocalDateTime.now());
+                stringRedisTemplate.opsForValue().set(key, JSONObject.toJSONString(userMap));
+            }
         }
         return staff;
     }

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

@@ -553,10 +553,10 @@
         tmc.last_follow_status as "lastFollowStatus",
         tmc.last_follow_time   as "lastFollowTime"
         from dkic_b.t_mst_customer as tmc
-        inner join dkic_b.t_mst_org tmo on tmc.org_id = tmo.org_id
-        inner join dkic_b.t_mst_staff tms on tmc.staff_id = tms.staff_id
-        inner join dkic_b.t_mst_staff as reportstaff on tmc.report_staff = reportstaff.staff_id
-        inner join dkic_b.t_mst_sale_channel tmsc on tmc.channel_id = tmsc.channel_id
+        left join dkic_b.t_mst_org tmo on tmc.org_id = tmo.org_id
+        left join dkic_b.t_mst_staff tms on tmc.staff_id = tms.staff_id
+        left join dkic_b.t_mst_staff as reportstaff on tmc.report_staff = reportstaff.staff_id
+        left 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}

+ 7 - 7
src/main/java/com/dk/mdm/mapper/mac/AccountObjectMapper.xml

@@ -107,7 +107,7 @@
     <select id="selectByCond" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_account_object
+        FROM dkic_b.t_mac_account_object
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -118,7 +118,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_account_object
+        FROM dkic_b.t_mac_account_object
         <include refid="Condition"/>
     </select>
 
@@ -126,7 +126,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_account_object
+        FROM dkic_b.t_mac_account_object
         WHERE object_id = #{objectId}::uuid
     </select>
 
@@ -134,8 +134,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_account_object
-        WHERE object_id = #{objectId}
+        FROM dkic_b.t_mac_account_object
+        WHERE object_id = #{id}::uuid
         for update
     </select>
 
@@ -143,13 +143,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_account_object
+        FROM dkic_b.t_mac_account_object
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_account_object
+        insert into dkic_b.t_mac_account_object
         (
         <trim suffixOverrides=",">
             object_type,

+ 5 - 5
src/main/java/com/dk/mdm/mapper/mac/ReceiptMapper.xml

@@ -199,7 +199,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_receipt as t
+        FROM dkic_b.t_mac_receipt as t
                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
         <include refid="Condition"/>
     </select>
@@ -208,7 +208,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receipt
+        FROM dkic_b.t_mac_receipt
         WHERE receipt_id = #{receiptId}::uuid
     </select>
 
@@ -216,8 +216,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receipt
-        WHERE receipt_id = #{receiptId}
+        FROM dkic_b.t_mac_receipt
+        WHERE receipt_id = #{id}::uuid
         for update
     </select>
 
@@ -231,7 +231,7 @@
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_receipt
+        insert into dkic_b.t_mac_receipt
         (
         <trim suffixOverrides=",">
             receipt_no,

+ 7 - 7
src/main/java/com/dk/mdm/mapper/mac/ReceivableHandleItemMapper.xml

@@ -111,7 +111,7 @@
     <select id="selectByCond" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle_item
+        FROM dkic_b.t_mac_receivable_handle_item
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -122,7 +122,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_receivable_handle_item
+        FROM dkic_b.t_mac_receivable_handle_item
         <include refid="Condition"/>
     </select>
 
@@ -130,7 +130,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle_item
+        FROM dkic_b.t_mac_receivable_handle_item
         WHERE item_id = #{itemId}::uuid
     </select>
 
@@ -138,8 +138,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle_item
-        WHERE item_id = #{itemId}
+        FROM dkic_b.t_mac_receivable_handle_item
+        WHERE item_id = #{id}::uuid
         for update
     </select>
 
@@ -147,13 +147,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle_item
+        FROM dkic_b.t_mac_receivable_handle_item
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_receivable_handle_item
+        insert into dkic_b.t_mac_receivable_handle_item
         (
         <trim suffixOverrides=",">
             handle_id,

+ 7 - 7
src/main/java/com/dk/mdm/mapper/mac/ReceivableHandleMapper.xml

@@ -111,7 +111,7 @@
     <select id="selectByCond" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle
+        FROM dkic_b.t_mac_receivable_handle
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -122,7 +122,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_receivable_handle
+        FROM dkic_b.t_mac_receivable_handle
         <include refid="Condition"/>
     </select>
 
@@ -130,7 +130,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle
+        FROM dkic_b.t_mac_receivable_handle
         WHERE handle_id = #{handleId}::uuid
     </select>
 
@@ -138,8 +138,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle
-        WHERE handle_id = #{handleId}
+        FROM dkic_b.t_mac_receivable_handle
+        WHERE handle_id = #{id}::uuid
         for update
     </select>
 
@@ -147,13 +147,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable_handle
+        FROM dkic_b.t_mac_receivable_handle
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_receivable_handle
+        insert into dkic_b.t_mac_receivable_handle
         (
         <trim suffixOverrides=",">
             handle_no,

+ 7 - 7
src/main/java/com/dk/mdm/mapper/mac/ReceivableMapper.xml

@@ -143,7 +143,7 @@
     <select id="selectByCond" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable
+        FROM dkic_b.t_mac_receivable
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -154,7 +154,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_receivable
+        FROM dkic_b.t_mac_receivable
         <include refid="Condition"/>
     </select>
 
@@ -162,7 +162,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable
+        FROM dkic_b.t_mac_receivable
         WHERE rec_id = #{recId}::uuid
     </select>
 
@@ -170,8 +170,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable
-        WHERE rec_id = #{recId}
+        FROM dkic_b.t_mac_receivable
+        WHERE rec_id = #{id}::uuid
         for update
     </select>
 
@@ -179,13 +179,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_receivable
+        FROM dkic_b.t_mac_receivable
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_receivable
+        insert into dkic_b.t_mac_receivable
         (
         <trim suffixOverrides=",">
             rec_no,

+ 7 - 7
src/main/java/com/dk/mdm/mapper/mac/TransferMapper.xml

@@ -111,7 +111,7 @@
     <select id="selectByCond" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_transfer
+        FROM dkic_b.t_mac_transfer
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -122,7 +122,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_transfer
+        FROM dkic_b.t_mac_transfer
         <include refid="Condition"/>
     </select>
 
@@ -130,7 +130,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_transfer
+        FROM dkic_b.t_mac_transfer
         WHERE trf_id = #{trfId}::uuid
     </select>
 
@@ -138,8 +138,8 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_transfer
-        WHERE trf_id = #{trfId}
+        FROM dkic_b.t_mac_transfer
+        WHERE trf_id = #{id}::uuid
         for update
     </select>
 
@@ -147,13 +147,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mac_transfer
+        FROM dkic_b.t_mac_transfer
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_mac_transfer
+        insert into dkic_b.t_mac_transfer
         (
         <trim suffixOverrides=",">
             trf_no,

+ 7 - 8
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -184,7 +184,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_psi_order_item as t
+        FROM dkic_b.t_psi_order_item as t
         <include refid="Condition"/>
     </select>
 
@@ -192,7 +192,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order_item
+        FROM dkic_b.t_psi_order_item
         WHERE item_id = #{itemId}::uuid
     </select>
 
@@ -200,7 +200,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order_item
+        FROM dkic_b.t_psi_order_item
         WHERE item_id = #{id}::uuid
         for update
     </select>
@@ -209,7 +209,7 @@
     <select id="selectByZIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order_item
+        FROM dkic_b.t_psi_order_item
         WHERE order_id = #{id}::uuid
         for update
     </select>
@@ -218,13 +218,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order_item
+        FROM dkic_b.t_psi_order_item
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_psi_order_item
+        insert into dkic_b.t_psi_order_item
         (
         <trim suffixOverrides=",">
             order_id,
@@ -279,8 +279,7 @@
     </insert>
 
     <delete id="deleteById">
-        DELETE
-        FROM dkic_b.t_psi_order_item
+        DELETE FROM dkic_b.t_psi_order_item
         WHERE item_id = #{id}::UUID;
     </delete>
 

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

@@ -530,7 +530,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order
+        FROM dkic_b.t_psi_order
         WHERE order_id = #{id}::uuid
         for update
     </select>
@@ -539,13 +539,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_order
+        FROM dkic_b.t_psi_order
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_psi_order
+        insert into dkic_b.t_psi_order
         (
         <trim suffixOverrides=",">
             order_no,

+ 9 - 9
src/main/java/com/dk/mdm/mapper/sale/OutReturnItemMapper.xml

@@ -179,7 +179,7 @@
                t.remarks,
                t.flg_valid,
                t.cp_id
-        FROM t_psi_out_return_item as t
+        FROM dkic_b.t_psi_out_return_item as t
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
                  left join dkic_b.t_psi_outbound as tpo on tpo.out_id = t.out_id
         <include refid="Condition"/>
@@ -192,7 +192,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_psi_out_return_item as t
+        FROM dkic_b.t_psi_out_return_item as t
         <include refid="Condition"/>
     </select>
 
@@ -200,7 +200,7 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return_item
+        FROM dkic_b.t_psi_out_return_item
         WHERE item_id = #{itemId}::uuid
     </select>
 
@@ -208,7 +208,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return_item
+        FROM dkic_b.t_psi_out_return_item
         WHERE item_id = #{id}::uuid
         for update
     </select>
@@ -217,7 +217,7 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return_item
+        FROM dkic_b.t_psi_out_return_item
         <include refid="idsForeach"/>
         for update
     </select>
@@ -226,13 +226,13 @@
     <select id="selectByZIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return_item
+        FROM dkic_b.t_psi_out_return_item
         WHERE return_id = #{id}::uuid
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_psi_out_return_item
+        insert into dkic_b.t_psi_out_return_item
         (
         <trim suffixOverrides=",">
             return_id,
@@ -310,8 +310,8 @@
                t.item_amt,
                t.non_std_code,
                t.remarks
-        FROM t_psi_out_return_item as t
-                 left join t_psi_outbound_item as tpobi on tpobi.item_id = t.out_item_id
+        FROM dkic_b.t_psi_out_return_item as t
+                 left join dkic_b.t_psi_outbound_item as tpobi on tpobi.item_id = t.out_item_id
                  left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = tpobi.from_item_id
                  left join dkic_b.t_mst_goods_sku tmgs on tpobi.sku_id = tmgs.sku_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpobi.inv_id

+ 6 - 6
src/main/java/com/dk/mdm/mapper/sale/OutReturnMapper.xml

@@ -284,7 +284,7 @@
                t.make_time,
                t.cp_id,
                t.flg_valid
-        FROM t_psi_out_return as t
+        FROM dkic_b.t_psi_out_return as t
                  left join dkic_b.t_mst_sale_channel tmsc on t.sales_channel = tmsc.channel_id
                  left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
                  left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
@@ -303,7 +303,7 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_psi_out_return as t
+        FROM dkic_b.t_psi_out_return as t
                 left join dkic_b.t_mst_customer tmc on t.cus_id = tmc.cus_id
         <include refid="Condition"/>
     </select>
@@ -357,7 +357,7 @@
                t.make_time,
                t.cp_id,
                t.flg_valid
-        FROM t_psi_out_return as t
+        FROM dkic_b.t_psi_out_return as t
                  left join dkic_b.t_mst_sale_channel tmsc on t.sales_channel = tmsc.channel_id
                  left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
                  left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
@@ -373,7 +373,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return
+        FROM dkic_b.t_psi_out_return
         WHERE return_id = #{id}::uuid
         for update
     </select>
@@ -382,13 +382,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_psi_out_return
+        FROM dkic_b.t_psi_out_return
         <include refid="idsForeach"/>
         for update
     </select>
 
     <insert id="insertBatch">
-        insert into t_psi_out_return
+        insert into dkic_b.t_psi_out_return
         (
         <trim suffixOverrides=",">
             return_no,

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

@@ -88,32 +88,6 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc : 登录后获取信息
-     * @author : 周兴
-     * @date : 2024/3/4 11:41
-     */
-    @Transactional(
-            rollbackFor = {Exception.class}
-    )
-    public ResponseResultVO<Map<String, List<Map<String, Object>>>> getInfoAfterLogin(Map<String, Object> param) {
-        // 先根据userId查询当前企业的员工信息
-        StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString());
-        if (staff != null) {
-            // 存Redis
-            authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
-                    .setStaffCode(staff.getStaffCode())
-                    .setStaffName(staff.getStaffName())
-                    .setCpId(Integer.parseInt(param.get("cpId").toString()))
-                    .setAppCode(param.get("appCode").toString()));
-        }
-        // 获取菜单
-        List<Map<String, Object>> menuList = commonMapper.getMenuByUser(param);
-        Map<String, List<Map<String, Object>>> map = new HashMap<>();
-        map.put("menuList", menuList);
-        return ResponseResultUtil.success(map);
-    }
-
-    /**
      * @desc : 获取数据字典项目
      * @author : 王英杰
      * @date : 2023/1/6 11:41

+ 2 - 2
src/main/java/com/dk/mdm/service/core/UserService.java

@@ -279,8 +279,8 @@ public class UserService extends BaseService<User> {
 //                .setLoginType(Constant.IntegerConstant.LOG_LOGIN_LOGOUT.getValue()).setClientIp(httpServletRequest.getRemoteAddr())
 //                .setClientInfo(userAgent.toString()).setAppCode(u.getAppCode()));
         //清理redis
-        authUtils.cleanStaff();
-        authUtils.cleanLoginStaff();
+//        authUtils.cleanStaff();
+//        authUtils.cleanLoginStaff();
         return ResponseResultUtil.success();
     }
 

+ 49 - 2
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -9,10 +9,14 @@ import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mac.ReceiptConvert;
+import com.dk.mdm.mapper.mac.AccountObjectMapper;
+import com.dk.mdm.mapper.mac.ReceivableMapper;
+import com.dk.mdm.model.pojo.mac.AccountObject;
 import com.dk.mdm.model.pojo.mac.Receipt;
 import com.dk.mdm.mapper.mac.ReceiptMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mac.Receivable;
 import com.dk.mdm.model.query.mac.ReceiptQuery;
 import com.dk.mdm.model.response.mac.ReceiptResponse;
 import com.dk.mdm.model.vo.mac.ReceiptVO;
@@ -43,6 +47,15 @@ public class ReceiptService extends BaseService<Receipt> {
     private ReceiptMapper receiptMapper;
 
     @Autowired
+    private ReceivableMapper receivableMapper;  // 应收账款
+
+    @Autowired
+    private AccountObjectService accountObjectService;
+
+    @Autowired
+    private AccountObjectMapper accountObjectMapper;
+
+    @Autowired
     private CommonService commonService;
 
     @Autowired
@@ -80,11 +93,45 @@ public class ReceiptService extends BaseService<Receipt> {
                         .setReceiptType(Constant.DocumentType.ORDER.getName());
                 // 转化实体
                 Receipt receipt = receiptConvert.convertToPo(receiptVO);
-                // Receipt总单保存
+                // Receipt保存
                 super.insert(receipt);
+
+                // 插入应收账款
+                Receivable receivable = new Receivable();
+                // 获取单号
+                codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECEIVABLE.getName(), false);
+                receivable.setRecId(codeMap.get("outId").toString()).setRecNo(codeMap.get("outNote").toString())
+                        .setRecType(Constant.recType.SHOU_KUAN.getName()).setAccType(1).setRecDirection(false)
+                        .setObjectId(receiptVO.getCusId()).setOrgId(receiptVO.getOrgId()).setStaffId(receipt.getStaffId())
+                        .setAccDate(receiptVO.getReceiptDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName())
+                        .setAmtReceivable(receiptVO.getReceiptAmt().negate()).setAmtResidue(receiptVO.getReceiptAmt().negate())
+                        .setBiznisType("t_mac_receipt").setBiznisId(receiptVO.getReceiptId()).setBiznisNo(receiptVO.getReceiptNo())
+                        .setMakeStaff(receiptVO.getMakeStaff());
+                receivableMapper.insert(receivable);
+
+                // 更新收款单上的应收账款
+                Receipt receiptUpdate = new Receipt();
+                receiptUpdate.setReceivableId(receivable.getRecId()).setReceiptId(receiptVO.getReceiptId());
+                super.updateByUuid(receiptUpdate);
+
+                // 插入账款总表
+                AccountObject accountObjectForUpdate = accountObjectMapper.selectByIdForUpdate(receiptVO.getCusId());
+                // 没有账款对象,需要新建
+                if(accountObjectForUpdate == null){
+                    accountObjectForUpdate = new AccountObject();
+                    accountObjectForUpdate.setObjectId(receiptVO.getCusId()).setObjectType("对象类型-客户");
+                    accountObjectMapper.insert(accountObjectForUpdate);
+                }
+
+                // 更新账款总表上收款的相关字段
+                AccountObject accountObjectUpdate = new AccountObject();
+                accountObjectUpdate.setSumPayment(accountObjectForUpdate.getSumPayment().add(receiptVO.getReceiptAmt()))// 总收付
+                        .setSumMoney(accountObjectForUpdate.getSumMoney().add(receiptVO.getReceiptAmt()))// 总资金
+                        .setAmtRefundable(accountObjectForUpdate.getAmtRefundable().add(receiptVO.getReceiptAmt())) // 可退金额
+                        .setObjectId(accountObjectForUpdate.getObjectId());
+                accountObjectService.updateByUuid(accountObjectUpdate);
             }
         }
-
         return ResponseResultUtil.success();
     }
 

+ 1 - 0
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -276,6 +276,7 @@ public class StaffService extends BaseService<Staff> {
         if (staff != null) {
             // 存Redis
             authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
+                    .setWxUserId(staff.getWxUserId())
                     .setStaffCode(staff.getStaffCode())
                     .setStaffName(staff.getStaffName())
                     .setCpId(Integer.parseInt(param.get("cpId").toString()))