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

Merge remote-tracking branch 'origin/dev' into dev

xucaiqin 2 лет назад
Родитель
Сommit
1aa4202f68
23 измененных файлов с 331 добавлено и 225 удалено
  1. 1 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java
  2. 3 0
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java
  3. 2 6
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java
  4. 10 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java
  5. 10 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java
  6. 7 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java
  7. 8 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java
  8. 9 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java
  9. 9 0
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  10. 26 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml
  11. 26 0
      sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml
  12. 9 2
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java
  13. 0 12
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java
  14. 14 4
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java
  15. 11 4
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java
  16. 12 3
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java
  17. 15 2
      sckw-modules/sckw-message/src/main/java/com/sckw/message/service/SmsService.java
  18. 10 0
      sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsList.java
  19. 78 20
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java
  20. 13 7
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsStatisticsService.java
  21. 23 142
      sckw-modules/sckw-product/src/main/java/com/sckw/product/service/operation/GoodsManagerService.java
  22. 3 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java
  23. 32 22
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/common/enums/enums/DictTypeEnum.java

@@ -12,6 +12,7 @@ import lombok.Getter;
 @AllArgsConstructor
 public enum DictTypeEnum {
     MSG_CATEGORY("msg_category", "消息分类"),
+    MSG_STATUS("msg_status", "消息状态"),
     SEND_SMS_TYPE("send_sms_type", "发送短信类型"),
     INTEGRAL_TYPE("integral_type", "积分类型"),
     UNIT_TYPE("unit_type", "商品单位类型"),

+ 3 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -504,6 +504,9 @@ public class KwcContractLogisticsService {
         if (kwcContractLogisticsMapper.updateById(kwcContractLogistic) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
+
+        kwcContractLogisticsTrackService.saveContractLogisticsTrack(kwcContractLogistic.getId(), ContractTrackEnum.OVER.getCode());
+
     }
 
 

+ 2 - 6
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -20,6 +20,7 @@ import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.ContractStatusEnum;
+import com.sckw.core.model.enums.ContractTrackEnum;
 import com.sckw.core.model.enums.EntTypeEnum;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
@@ -569,12 +570,7 @@ public class KwcContractTradeService {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }
 
-        //完结相关订单
-        ContractSignCompletedParam contractSignCompletedParam = new ContractSignCompletedParam();
-        contractSignCompletedParam.setContractId(kwcContractTrade.getContractPid());
-        contractSignCompletedParam.setUpdateBy(LoginUserHolder.getUserId());
-        contractSignCompletedParam.setUpdateByName(LoginUserHolder.getUserName());
-        tradeOrderInfoService.contractSignCompleted(contractSignCompletedParam);
+        kwcContractTradeTrackService.saveContractTradeTrack(kwcContractTrade.getId(), ContractTrackEnum.OVER.getCode());
     }
 
 

+ 10 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverController.java

@@ -253,4 +253,14 @@ public class KwfDriverController {
         return driverService.forgetPassword(params);
     }
 
+    /**
+     * @desc 企业司机统计
+     * @author zk
+     * @date 2023/9/18
+     **/
+    @GetMapping("/driverStatistics")
+    public HttpResult driverStatistics() {
+        return HttpResult.ok(driverService.driverStatistics());
+    }
+
 }

+ 10 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfTruckController.java

@@ -217,6 +217,16 @@ public class KwfTruckController {
         return truckService.transportLicenseEdit(params);
     }
 
+    /**
+     * @desc 企业车辆统计
+     * @author zk
+     * @date 2023/9/18
+     **/
+    @GetMapping("/truckStatistics")
+    public HttpResult truckStatistics() {
+        return HttpResult.ok(truckService.truckStatistics());
+    }
+
     /**
      * @param params {truckNo 車牌號}
      * @desc 车辆查询(业务关联+归属车辆)

+ 7 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfDriverMapper.java

@@ -68,4 +68,11 @@ public interface KwfDriverMapper extends BaseMapper<KwfDriver> {
      * @return
      */
     KwfDriver findEntDriver(KwfDriver params);
+
+    /**
+     * 企业司机统计
+     * @param entId 企业id
+     * @return
+     */
+    Map<String, Object> driverStatistics(@Param("entId") Long entId);
 }

+ 8 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -86,4 +86,12 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
      * @return
      */
     List<KwfTruckMonitorVo> findTruckByAll(Map<String, Object> params);
+
+
+    /**
+     * 企业车辆统计
+     * @param entId 企业id
+     * @return
+     */
+    Map<String, Object> truckStatistics(@Param("entId") Long entId);
 }

+ 9 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -841,6 +841,15 @@ public class KwfDriverService {
         }
     }
 
+    /**
+     * @desc 企业司机统计
+     * @author zk
+     * @date 2023/9/18
+     **/
+    public Map<String, Object> driverStatistics() {
+        return driverDao.driverStatistics(LoginUserHolder.getEntId());
+    }
+
     /**
      * @param type 字典类型
      * @param value 字典值

+ 9 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -633,6 +633,15 @@ public class KwfTruckService {
         }
     }
 
+    /**
+     * @desc 企业车辆统计
+     * @author zk
+     * @date 2023/9/18
+     **/
+    public Map<String, Object> truckStatistics() {
+        return truckDao.truckStatistics(LoginUserHolder.getEntId());
+    }
+
     /**
      * @param params {truckNo 車牌號}
      * @desc 车辆查询(业务关联+归属车辆)

+ 26 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfDriverMapper.xml

@@ -305,4 +305,30 @@
         and dr.id = #{id, jdbcType=VARCHAR}
     </select>
 
+    <select id="driverStatistics" resultType="java.util.Map" >
+        select
+            tabA.abnormalTotal, tabB.idleTotal, tabC.inTaskTotal, (tabB.idleTotal + tabC.inTaskTotal) allTotal
+        from
+        (SELECT
+        count(1) abnormalTotal, '' indexNum
+        from kwf_driver tr
+        left join kwf_driver_ent tre on tre.driver_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.auth_status = 3 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabA
+        left join
+        (SELECT
+        count(1) idleTotal, '' indexNum
+        from kwf_driver tr
+        left join kwf_driver_ent tre on tre.driver_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 0 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabB	on tabB.indexNum = tabA.indexNum
+        left join
+        (SELECT
+        count(1) inTaskTotal, '' indexNum
+        from kwf_driver tr
+        left join kwf_driver_ent tre on tre.driver_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 1 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabC	on tabC.indexNum = tabA.indexNum
+    </select>
+
 </mapper>

+ 26 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -359,4 +359,30 @@
         </if>
     </select>
 
+    <select id="truckStatistics" resultType="java.util.Map" >
+        select
+        tabA.abnormalTotal, tabB.idleTotal, tabC.inTaskTotal, (tabB.idleTotal + tabC.inTaskTotal) allTotal
+        from
+        (SELECT
+        count(1) abnormalTotal, '' indexNum
+        from kwf_truck tr
+        left join kwf_truck_ent tre on tre.truck_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.auth_status = 3 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabA
+        left join
+        (SELECT
+        count(1) idleTotal, '' indexNum
+        from kwf_truck tr
+        left join kwf_truck_ent tre on tre.truck_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 0 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabB	on tabB.indexNum = tabA.indexNum
+        left join
+        (SELECT
+        count(1) inTaskTotal, '' indexNum
+        from kwf_truck tr
+        left join kwf_truck_ent tre on tre.truck_id = tr.id
+        where tr.del_flag = 0 and tre.del_flag = 0 and tr.business_status = 1 and tre.ent_id = #{entId, jdbcType=BIGINT}
+        ) tabC	on tabC.indexNum = tabA.indexNum
+    </select>
+
 </mapper>

+ 9 - 2
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/CommonBusinessService.java

@@ -3,6 +3,7 @@ package com.sckw.manage.service;
 import com.alibaba.fastjson2.JSON;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.enums.ClientTypeEnum;
 import com.sckw.core.model.enums.CooperateStatusEnum;
 import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.utils.AsyncThreadUtils;
@@ -367,12 +368,18 @@ public class CommonBusinessService {
     }
 
 
-    public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl) {
+    public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl, String appMsgUrl) {
         SckwMessage msg = new SckwMessage();
+        Map<String, String> msgUrls = new HashMap<>(Global.NUMERICAL_FOUR);
+        msgUrls.put(ClientTypeEnum.pc.getValue(), msgUrl);
+        if (StringUtils.isNotBlank(appMsgUrl)) {
+            msgUrls.put(ClientTypeEnum.app.getValue(), appMsgUrl);
+        }
+
         msg.setRequestId(UUIDUtils.get32UUID())
                 .setMessageEnum(messageEnum)
                 .setParams(map)
-                .setMsgUrl(msgUrl)
+                .setMsgUrls(msgUrls)
                 .setUserInfos(userInfos)
                 .setCreateBy(LoginUserHolder.getUserId());
         AsyncThreadUtils.submit(new AsyncProcess(msg, streamBridge));

+ 0 - 12
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -444,16 +444,4 @@ public class KwmAddressService {
         return addressDetailResVo;
     }
 
-    public void test() {
-        Map<String, Object> map = new HashMap<>();
-        map.put("entName", "测试企业");
-        map.put("createByName", LoginUserHolder.getUserName());
-        commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId())),
-                MessageEnum.SUBMIT_COOPERATE,
-                map,
-                "testUrl");
-
-        String msg = "{\"createBy\":156382319433748480,\"messageEnum\":\"SUBMIT_COOPERATE\",\"msgUrl\":\"testUrl\",\"params\":{\"createByName\":\"楚镇豪-企业管理员\",\"entName\":\"徐长卿\"},\"requestId\":\"cefb6b5357ce48d9a11ffc94da83c879\",\"userInfos\":[{\"entId\":156382319450525696,\"userId\":156382319433748480}]}";
-        streamBridge.send("sckw-message", com.alibaba.fastjson2.JSON.toJSONString(msg));
-    }
 }

+ 14 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateApplyService.java

@@ -72,6 +72,12 @@ public class KwmCooperateApplyService {
     @Value(value = "${jumpUrl.cooperateApplyUrl}")
     private String cooperateApplyUrl;
 
+    @Value(value = "${jumpUrl.cooperateManageUrl}")
+    private String cooperateManageUrl;
+
+    @Value(value = "${jumpUrl.appCooperateApplyUrl}")
+    private String appCooperateApplyUrl;
+
     /**
      * @param reqVo 分页入参
      * @return HttpResult
@@ -284,7 +290,8 @@ public class KwmCooperateApplyService {
         commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId())),
                 MessageEnum.SUBMIT_COOPERATE,
                 map,
-                cooperateApplyUrl);
+                cooperateApplyUrl,
+                appCooperateApplyUrl);
 
         //合作申请待审核消息
         EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(reqVo.getEntId());
@@ -293,7 +300,8 @@ public class KwmCooperateApplyService {
         commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto1.getContactsId()).setEntId(entCacheResDto1.getId())),
                 MessageEnum.COOPERATE_WAIT_APPROVAL,
                 map,
-                cooperateApplyUrl);
+                cooperateApplyUrl,
+                appCooperateApplyUrl);
     }
 
 
@@ -534,7 +542,8 @@ public class KwmCooperateApplyService {
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto.getContactsId()).setEntId(entCacheResDto.getId())),
                         MessageEnum.COOPERATE_PASS,
                         map,
-                        cooperateApplyUrl);
+                        cooperateManageUrl,
+                        appCooperateApplyUrl);
             } else {
                 KwmCooperate kwmCooperate = kwmCooperateMapper.selectById(Long.parseLong(id));
                 EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(kwmCooperate.getEntId());
@@ -543,7 +552,8 @@ public class KwmCooperateApplyService {
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(entCacheResDto.getContactsId()).setEntId(entCacheResDto.getId())),
                         MessageEnum.COOPERATE_REFUSED,
                         map,
-                        cooperateApplyUrl);
+                        cooperateApplyUrl,
+                        appCooperateApplyUrl);
             }
         }
     }

+ 11 - 4
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -85,6 +85,9 @@ public class KwmCooperateManageService {
     @Value(value = "${jumpUrl.cooperateManageUrl}")
     private String cooperateManageUrl;
 
+    @Value(value = "${jumpUrl.appCooperateApplyUrl}")
+    private String appCooperateApplyUrl;
+
     /**
      * @param reqVo 分页入参
      * @return PageResult
@@ -240,26 +243,30 @@ public class KwmCooperateManageService {
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
                         MessageEnum.COOPERATE_DISSOLVE,
                         map,
-                        cooperateManageUrl);
+                        cooperateManageUrl,
+                        appCooperateApplyUrl);
 
                 map.put("entName", ourEntCacheResDto.getFirmName());
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
                         MessageEnum.COOPERATE_DISSOLVED,
                         map,
-                        cooperateManageUrl);
+                        cooperateManageUrl,
+                        appCooperateApplyUrl);
             } else {
                 map.put("entName", targetEntCacheResDto.getFirmName());
                 map.put("createByName", LoginUserHolder.getUserName());
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(ourEntTopCacheResDto.getContactsId()).setEntId(ourEntTopCacheResDto.getId())),
                         MessageEnum.COOPERATE_RESTORE,
                         map,
-                        cooperateManageUrl);
+                        cooperateManageUrl,
+                        appCooperateApplyUrl);
 
                 map.put("entName", ourEntCacheResDto.getFirmName());
                 commonBusinessService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(targetEntTreeCacheResDto.getContactsId()).setEntId(targetEntTreeCacheResDto.getId())),
                         MessageEnum.COOPERATE_RESTORED,
                         map,
-                        cooperateManageUrl);
+                        cooperateManageUrl,
+                        appCooperateApplyUrl);
             }
 
         }

+ 12 - 3
sckw-modules/sckw-message/src/main/java/com/sckw/message/service/MessageService.java

@@ -1,7 +1,6 @@
 package com.sckw.message.service;
 
 import com.alibaba.fastjson2.JSONObject;
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
@@ -123,6 +122,16 @@ public class MessageService {
         if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();
         }
+        Map<String, String> categoryMap, statusMap;
+        Map<String, Map<String, String>> dictMap = remoteSystemService.queryDictByType(
+                Arrays.asList(DictTypeEnum.MSG_CATEGORY.getType(), DictTypeEnum.MSG_STATUS.getType()));
+        if (CollectionUtils.isNotEmpty(dictMap)) {
+            categoryMap = dictMap.get(DictTypeEnum.MSG_CATEGORY.getType());
+            statusMap = dictMap.get(DictTypeEnum.MSG_STATUS.getType());
+        } else {
+            categoryMap = new HashMap<>();
+            statusMap = new HashMap<>();
+        }
         String clientType = LoginUserHolder.getClientType();
         List<Long> userIds = list.stream().map(MessageListDTO::getCreateBy).toList();
         Map<Long, UserCacheResDto> map = remoteSystemService.queryUserCacheMapByIds(userIds);
@@ -134,8 +143,8 @@ public class MessageService {
                 Map<String, Object> urlMap = JSONObject.parse(e.getUrl());
                 res.setUrl(Objects.isNull(urlMap.get(clientType)) ? null : urlMap.get(clientType).toString());
             }
-            res.setStatusLabel(MsgStatusEnum.getNameByCode(res.getStatus()));
-            res.setCategoryLabel(DictEnum.getLabel(DictTypeEnum.MSG_CATEGORY.getType(), e.getCategory()));
+            res.setStatusLabel(statusMap.get(String.valueOf(e.getStatus())));
+            res.setCategoryLabel(categoryMap.get(e.getCategory()));
             if (Objects.nonNull(user)) {
                 res.setCreateByName(user.getName());
                 EntCacheResDto entInfo = user.getEntInfo();

+ 15 - 2
sckw-modules/sckw-message/src/main/java/com/sckw/message/service/SmsService.java

@@ -1,10 +1,10 @@
 package com.sckw.message.service;
 
 import com.alibaba.fastjson2.JSON;
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.message.model.vo.req.GetSmsVerifyCoderReqVO;
@@ -13,11 +13,14 @@ import com.sckw.redis.constant.RedisConstant;
 import com.sckw.redis.utils.RedissonUtils;
 import com.sckw.stream.enums.SmsCodeEnum;
 import com.sckw.stream.model.SckwSms;
+import com.sckw.system.api.RemoteSystemService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -34,6 +37,9 @@ public class SmsService {
 
     private final StreamBridge streamBridge;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
     /**
      * @param param
      * @return com.sckw.core.web.response.HttpResult
@@ -42,8 +48,15 @@ public class SmsService {
      * @date: 2023-06-13 13:43
      */
     public void sendVerifyCode(SendSmsVerifyCoderReqVO param) {
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(Collections.singletonList(DictTypeEnum.SEND_SMS_TYPE.getType()));
+        Map<String, String> map;
+        if (CollectionUtils.isNotEmpty(dict)){
+            map = dict.get(DictTypeEnum.SEND_SMS_TYPE.getType());
+        }else {
+            map = new HashMap<>();
+        }
         String type = param.getType();
-        if (Objects.isNull(DictEnum.getLabel(DictTypeEnum.SEND_SMS_TYPE.getType(), type))) {
+        if (Objects.isNull(map.get(type))) {
             throw new BusinessException("非法短信类型!");
         }
         String phone = param.getPhone();

+ 10 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsList.java

@@ -25,6 +25,11 @@ public class GoodsList {
      */
     private Long id;
 
+    /**
+     * 商品编号
+     */
+    private String code;
+
     /**
      * 状态:0草稿/1上架/2下架
      */
@@ -95,6 +100,11 @@ public class GoodsList {
      */
     private String prepaidLimitLabel;
 
+    /**
+     * 预付款最低限额
+     */
+    private BigDecimal advancePrice;
+
     /**
      * 最高单价
      */

+ 78 - 20
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.CustomPromptException;
@@ -204,6 +203,13 @@ public class KwpGoodsService {
         if (CollectionUtils.isEmpty(list)) {
             return detail;
         }
+        Map<String, String> unitMap;
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
+        if (CollectionUtils.isNotEmpty(dict)) {
+            unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+        } else {
+            unitMap = new HashMap<>();
+        }
         List<Long> goodsIds = list.stream().map(KwpGoods::getId).toList();
         Map<Long, List<KwpGoodsPriceRange>> map = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
                 .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
@@ -211,7 +217,7 @@ public class KwpGoodsService {
         list.forEach(e -> {
             RecommendGoods recommendGoods = BeanUtils.copyProperties(e, RecommendGoods.class);
             List<KwpGoodsPriceRange> prices = map.get(recommendGoods.getId());
-            recommendGoods.setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), recommendGoods.getUnit()))
+            recommendGoods.setUnitLabel(unitMap.get(recommendGoods.getUnit()))
                     .setPrice(CollectionUtils.isNotEmpty(prices) ? prices.get(0).getPrice() : null);
             recommendGoodsList.add(recommendGoods);
         });
@@ -246,10 +252,24 @@ public class KwpGoodsService {
         if (Objects.nonNull(managerInfo)) {
             detail.setManagerName(managerInfo.getName()).setManagerPhone(managerInfo.getPhone());
         }
-        detail.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType()))
-                .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), detail.getUnit()))
-                .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), detail.getTaxRate()))
-                .setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(detail.getStatus())))
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
+                DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.TAX_RATE.getType(), DictTypeEnum.GOODS_STATUS.getType(), DictTypeEnum.ADDRESS_TYPE.getType()));
+        Map<String, String> productNameMap = new HashMap<>();
+        Map<String, String> unitMap = new HashMap<>();
+        Map<String, String> taxRateMap = new HashMap<>();
+        Map<String, String> goodsStatusMap = new HashMap<>();
+        Map<String, String> addressMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(dict)) {
+            productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
+            unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+            taxRateMap = dict.get(DictTypeEnum.TAX_RATE.getType());
+            goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
+            addressMap = dict.get(DictTypeEnum.ADDRESS_TYPE.getType());
+        }
+        detail.setGoodsTypeLabel(productNameMap.get(detail.getGoodsType()))
+                .setUnitLabel(unitMap.get(detail.getUnit()))
+                .setTaxRateLabel(taxRateMap.get(detail.getTaxRate()))
+                .setStatusLabel(goodsStatusMap.get(String.valueOf(detail.getStatus())))
                 .setPrepaidLimitLabel(Objects.equals(detail.getPrepaidLimit(), 1) ? "是" : "否");
         //商品图片信息
         List<KwpGoodsImage> goodsImages = kwpGoodsImageService.getByGoodsId(id);
@@ -268,7 +288,7 @@ public class KwpGoodsService {
         KwpGoodsAddress goodsAddress = kwpGoodsAddressService.getByGoodsId(id);
         AddressInfoDetail addressInfo = BeanUtils.copyProperties(goodsAddress, AddressInfoDetail.class);
         if (Objects.nonNull(addressInfo)) {
-            addressInfo.setTypeName(DictEnum.getLabel(DictTypeEnum.ADDRESS_TYPE.getType(), addressInfo.getType()));
+            addressInfo.setTypeName(addressMap.get(addressInfo.getType()));
         }
         detail.setImages(images).setPriceRanges(ranges).setAttributes(attributes).setAddressInfo(addressInfo);
 
@@ -531,11 +551,23 @@ public class KwpGoodsService {
     public List<GoodsListExport> export(ExportStatisticGoodsListParam params) {
         LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(params);
         List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
-        List<GoodsList> goodsLists = buildGoodLists(list);
-        if (CollectionUtils.isEmpty(goodsLists)) {
+        if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();
         }
-        List<GoodsListExport> result = new ArrayList<>();
+        return getExportResults(list);
+
+    }
+
+    /**
+     * @desc: 获取导出结果
+     * @author: yzc
+     * @date: 2023-09-18 15:19
+     * @Param list:
+     * @return: java.util.List<com.sckw.product.model.GoodsListExport>
+     */
+    public List<GoodsListExport> getExportResults(List<KwpGoods> list) {
+        List<GoodsList> goodsLists = buildGoodLists(list);
+        List<GoodsListExport> result = new ArrayList<>(list.size());
         AtomicInteger i = new AtomicInteger(1);
         goodsLists.forEach(e -> {
             GoodsListExport export = BeanUtils.copyProperties(e, GoodsListExport.class);
@@ -604,7 +636,7 @@ public class KwpGoodsService {
      * @Param list:
      * @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
      */
-    private List<GoodsList> buildGoodLists(List<KwpGoods> list) {
+    public List<GoodsList> buildGoodLists(List<KwpGoods> list) {
         List<GoodsList> result = new ArrayList<>(list.size());
         List<Long> goodsIds = new ArrayList<>(list.size());
         List<Long> supplyEntIds = new ArrayList<>(list.size());
@@ -634,16 +666,30 @@ public class KwpGoodsService {
         if (CollectionUtils.isNotEmpty(supplyEntIds)) {
             entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
         }
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
+                DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.TAX_RATE.getType(), DictTypeEnum.GOODS_STATUS.getType()));
+        Map<String, String> productNameMap, unitMap, taxRateMap, goodsStatusMap;
+        if (CollectionUtils.isNotEmpty(dict)) {
+            productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
+            unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+            taxRateMap = dict.get(DictTypeEnum.TAX_RATE.getType());
+            goodsStatusMap = dict.get(DictTypeEnum.GOODS_STATUS.getType());
+        } else {
+            productNameMap = new HashMap<>();
+            unitMap = new HashMap<>();
+            taxRateMap = new HashMap<>();
+            goodsStatusMap = new HashMap<>();
+        }
         Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
         list.forEach(e -> {
             Long id = e.getId();
             GoodsList goodsList = BeanUtils.copyProperties(e, GoodsList.class);
             UserCacheResDto manager = userMap.get(e.getManager());
             UserCacheResDto createUser = userMap.get(e.getCreateBy());
-            goodsList.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(goodsList.getStatus())))
-                    .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), goodsList.getGoodsType()))
-                    .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), goodsList.getUnit()))
-                    .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), goodsList.getTaxRate()))
+            goodsList.setStatusLabel(goodsStatusMap.get(String.valueOf(goodsList.getStatus())))
+                    .setGoodsTypeLabel(productNameMap.get(goodsList.getGoodsType()))
+                    .setUnitLabel(unitMap.get(goodsList.getUnit()))
+                    .setTaxRateLabel(taxRateMap.get(goodsList.getTaxRate()))
                     .setPrepaidLimitLabel(Objects.equals(e.getPrepaidLimit(), 1) ? "是" : "否")
                     .setAddress(addressMap.get(id)).setSupplyEnt(entMap.get(e.getSupplyEntId()))
                     .setManageName(Objects.nonNull(manager) ? manager.getName() : null)
@@ -651,7 +697,8 @@ public class KwpGoodsService {
                     .setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
             List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
             if (CollectionUtils.isNotEmpty(priceRanges)) {
-                goodsList.setHighestPrice(priceRanges.get(priceRanges.size() - 1).getPrice()).setLowestPrice(priceRanges.get(0).getPrice());
+                goodsList.setHighestPrice(priceRanges.get(priceRanges.size() - 1).getPrice())
+                        .setLowestPrice(priceRanges.get(0).getPrice());
             }
             result.add(goodsList);
         });
@@ -835,13 +882,22 @@ public class KwpGoodsService {
         //供应企业信息
         List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
         Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
-
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
+                DictTypeEnum.UNIT_TYPE.getType()));
+        Map<String, String> productNameMap, unitMap;
+        if (CollectionUtils.isNotEmpty(dict)) {
+            productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
+            unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+        } else {
+            productNameMap = new HashMap<>();
+            unitMap = new HashMap<>();
+        }
         list.forEach(e -> {
             BuildingMaterialsMarketList materials = BeanUtils.copyProperties(e, BuildingMaterialsMarketList.class);
             KwpGoodsAddress address = addressMap.get(e.getId());
             List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
-            materials.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
-                    .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), e.getUnit()))
+            materials.setGoodsTypeLabel(productNameMap.get(e.getGoodsType()))
+                    .setUnitLabel(unitMap.get(e.getUnit()))
                     .setAddressName(Objects.isNull(address) ? null : address.getCityName())
                     .setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress())
                     .setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice())
@@ -1012,7 +1068,9 @@ public class KwpGoodsService {
         }
         try {
             LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(KwpGoods::getId, id).eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode()).eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
+            wrapper.eq(KwpGoods::getId, id)
+                    .eq(KwpGoods::getStatus, GoodsStatusEnum.PUT_ON_SHELVES.getCode())
+                    .eq(KwpGoods::getDelFlag, Global.NO).last("LIMIT 1");
             KwpGoods goods = kwpGoodsMapper.selectOne(wrapper);
             if (Objects.isNull(goods)) {
                 throw new BusinessException("商品不存在或已下架!");

+ 13 - 7
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsStatisticsService.java

@@ -1,6 +1,5 @@
 package com.sckw.product.service;
 
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
@@ -14,10 +13,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -57,11 +53,21 @@ public class KwpGoodsStatisticsService {
         if (CollectionUtils.isNotEmpty(supplyEntIds)) {
             entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
         }
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.PRODUCT_NAME_TYPE.getType(),
+                DictTypeEnum.UNIT_TYPE.getType()));
+        Map<String, String> productNameMap, unitMap;
+        if (CollectionUtils.isEmpty(dict)) {
+            productNameMap = new HashMap<>();
+            unitMap = new HashMap<>();
+        } else {
+            productNameMap = dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
+            unitMap = dict.get(DictTypeEnum.UNIT_TYPE.getType());
+        }
         Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
         goodsList.forEach(e -> {
             WorkbenchGoodsRes goods = BeanUtils.copyProperties(e, WorkbenchGoodsRes.class);
-            goods.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()))
-                    .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), e.getUnit()))
+            goods.setGoodsTypeLabel(productNameMap.get(e.getGoodsType()))
+                    .setUnitLabel(unitMap.get(e.getUnit()))
                     .setSupplyFireName(entMap.get(e.getSupplyEntId()));
             List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(e.getId());
             if (CollectionUtils.isNotEmpty(priceRanges)) {

+ 23 - 142
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/operation/GoodsManagerService.java

@@ -3,9 +3,6 @@ package com.sckw.product.service.operation;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.sckw.core.common.enums.enums.DictEnum;
-import com.sckw.core.common.enums.enums.DictTypeEnum;
-import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableBottom;
@@ -14,33 +11,30 @@ import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.StringUtils;
-import com.sckw.excel.utils.DateUtil;
 import com.sckw.product.dao.KwpGoodsMapper;
 import com.sckw.product.enums.GoodsStatusEnum;
-import com.sckw.product.model.*;
+import com.sckw.product.model.GoodsListExport;
+import com.sckw.product.model.KwpGoods;
+import com.sckw.product.model.OperationGoodsListExport;
 import com.sckw.product.model.dto.OperatorGoodsListQueryDTO;
 import com.sckw.product.model.vo.req.OperatorGoodsExportQueryVO;
 import com.sckw.product.model.vo.req.OperatorGoodsListQueryVO;
 import com.sckw.product.model.vo.req.OperatorGoodsStsQueryVO;
-import com.sckw.product.model.vo.res.*;
-import com.sckw.product.service.KwpGoodsAddressService;
-import com.sckw.product.service.KwpGoodsAttributeService;
-import com.sckw.product.service.KwpGoodsImageService;
-import com.sckw.product.service.KwpGoodsPriceRangeService;
+import com.sckw.product.model.vo.res.GoodsDetail;
+import com.sckw.product.model.vo.res.GoodsList;
+import com.sckw.product.model.vo.res.OperationGoodsDetail;
+import com.sckw.product.model.vo.res.OperationGoodsList;
+import com.sckw.product.service.KwpGoodsService;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.RemoteUserService;
-import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.KwsUserResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
-import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 /**
@@ -60,13 +54,17 @@ public class GoodsManagerService {
     private RemoteUserService remoteUserService;
 
 
+    private final KwpGoodsService kwpGoodsService;
     private final KwpGoodsMapper kwpGoodsMapper;
-    private final KwpGoodsAddressService kwpGoodsAddressService;
-    private final KwpGoodsAttributeService kwpGoodsAttributeService;
-    private final KwpGoodsImageService kwpGoodsImageService;
-    private final KwpGoodsPriceRangeService kwpGoodsPriceRangeService;
 
 
+    /**
+     * @desc: 分页查询
+     * @author: yzc
+     * @date: 2023-09-18 15:19
+     * @Param params:
+     * @return: com.sckw.core.model.page.PageResult
+     */
     public PageResult select(OperatorGoodsListQueryVO params) {
         LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
         Page<KwpGoods> page = new Page<>(params.getPage(), params.getPageSize());
@@ -75,7 +73,8 @@ public class GoodsManagerService {
         if (CollectionUtils.isEmpty(list)) {
             return PageResult.build(params.getPage(), params.getPageSize(), goodsIpage.getTotal(), Collections.emptyList());
         }
-        List<OperationGoodsList> result = buildGoodLists(list);
+        List<GoodsList> goodsLists = kwpGoodsService.buildGoodLists(list);
+        List<OperationGoodsList> result = BeanUtils.copyToList(goodsLists, OperationGoodsList.class);
         return PageResult.build(params.getPage(), params.getPageSize(), goodsIpage.getTotal(), result);
     }
 
@@ -129,67 +128,6 @@ public class GoodsManagerService {
         return wrapper;
     }
 
-    /**
-     * @desc: 构建商品列表
-     * @author: lt
-     * @date: 2023-09-14 10:14
-     * @Param list:
-     * @return: java.util.List<com.sckw.product.model.vo.res.GoodsList>
-     */
-    private List<OperationGoodsList> buildGoodLists(List<KwpGoods> list) {
-        List<OperationGoodsList> result = new ArrayList<>(list.size());
-        List<Long> goodsIds = new ArrayList<>(list.size());
-        List<Long> supplyEntIds = new ArrayList<>(list.size());
-        List<Long> userIds = new ArrayList<>();
-        list.forEach(e -> {
-            goodsIds.add(e.getId());
-            if (Objects.nonNull(e.getSupplyEntId())) {
-                supplyEntIds.add(e.getSupplyEntId());
-            }
-            if (Objects.nonNull(e.getManager())) {
-                userIds.add(e.getManager());
-            }
-            if (Objects.nonNull(e.getCreateBy())) {
-                userIds.add(e.getCreateBy());
-            }
-        });
-        //地址信息
-        Map<Long, String> addressMap = kwpGoodsAddressService.getByGoodsIds(goodsIds).stream()
-                .collect(Collectors.toMap(KwpGoodsAddress::getGoodsId, KwpGoodsAddress::getName, (k1, k2) -> k1));
-        //价格梯度信息
-        Map<Long, List<KwpGoodsPriceRange>> priceRangeMap = kwpGoodsPriceRangeService.getByGoodsIds(goodsIds).stream()
-                .collect(Collectors.groupingBy(KwpGoodsPriceRange::getGoodsId));
-        //用户信息
-        Map<Long, UserCacheResDto> userMap = remoteSystemService.queryUserCacheMapByIds(userIds);
-        //供应企业信息
-        List<EntCacheResDto> entList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(supplyEntIds)) {
-            entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
-        }
-        Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
-        list.forEach(e -> {
-            Long id = e.getId();
-            OperationGoodsList operationGoodsList = BeanUtils.copyProperties(e, OperationGoodsList.class);
-            UserCacheResDto manager = userMap.get(e.getManager());
-            UserCacheResDto createUser = userMap.get(e.getCreateBy());
-            operationGoodsList.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(operationGoodsList.getStatus())))
-                    .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), operationGoodsList.getGoodsType()))
-                    .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), operationGoodsList.getUnit()))
-                    .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), operationGoodsList.getTaxRate()))
-                    .setPrepaidLimitLabel(Objects.equals(e.getPrepaidLimit(), 1) ? "是" : "否")
-                    .setAddress(addressMap.get(id)).setSupplyEnt(entMap.get(e.getSupplyEntId()))
-                    .setManageName(Objects.nonNull(manager) ? manager.getName() : null)
-                    .setPhone(Objects.nonNull(manager) ? manager.getPhone() : null)
-                    .setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
-            List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
-            if (CollectionUtils.isNotEmpty(priceRanges)) {
-                operationGoodsList.setHighestPrice(priceRanges.get(priceRanges.size() - 1).getPrice()).setLowestPrice(priceRanges.get(0).getPrice());
-            }
-            result.add(operationGoodsList);
-        });
-        return result;
-    }
-
     /**
      * @desc: 获取商品详情
      * @author: lt
@@ -198,52 +136,8 @@ public class GoodsManagerService {
      * @return: com.sckw.product.model.vo.res.GoodsDetail
      */
     public OperationGoodsDetail getDetail(Long id) {
-        KwpGoods goods = kwpGoodsMapper.selectById(id);
-        if (Objects.isNull(goods)) {
-            throw new BusinessException("当前商品不存在!");
-        }
-        OperationGoodsDetail detail = BeanUtils.copyProperties(goods, OperationGoodsDetail.class);
-        Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntCacheMapByIds(Arrays.asList(detail.getEntId(), detail.getSupplyEntId()));
-        EntCacheResDto ent = entMap.get(detail.getEntId());
-        if (Objects.nonNull(ent)) {
-            detail.setEnt(ent.getFirmName()).setEntHead(ent.getHead())
-                    .setEntBusiness(ent.getBusiness()).setEntAddress(ent.getCityName());
-        }
-        EntCacheResDto supplyEnt = entMap.get(detail.getSupplyEntId());
-        if (Objects.nonNull(supplyEnt)) {
-            detail.setSupplyEnt(supplyEnt.getFirmName());
-        }
-        UserCacheResDto managerInfo = remoteSystemService.queryUserCacheById(detail.getManager());
-        if (Objects.nonNull(managerInfo)) {
-            detail.setManagerName(managerInfo.getName()).setManagerPhone(managerInfo.getPhone());
-        }
-        detail.setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), detail.getGoodsType()))
-                .setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), detail.getUnit()))
-                .setTaxRateLabel(DictEnum.getLabel(DictTypeEnum.TAX_RATE.getType(), detail.getTaxRate()))
-                .setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(detail.getStatus())))
-                .setPrepaidLimitLabel(Objects.equals(detail.getPrepaidLimit(), 1) ? "是" : "否");
-        //商品图片信息
-        List<KwpGoodsImage> goodsImages = kwpGoodsImageService.getByGoodsId(id);
-        List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
-        //商品价格段信息
-        List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
-        List<GoodsPriceRangesDetail> ranges = BeanUtils.copyToList(priceRanges, GoodsPriceRangesDetail.class);
-        ranges.stream().filter(r -> r.getEndAmount().compareTo(new BigDecimal("-1.00")) == 0)
-                .forEach(r -> {
-                    r.setEndAmountLabel("不限");
-                });
-        //商品属性信息
-        List<KwpGoodsAttribute> attributesList = kwpGoodsAttributeService.getByGoodsId(id);
-        List<GoodsAttributesDetail> attributes = BeanUtils.copyToList(attributesList, GoodsAttributesDetail.class);
-        //商品地址信息
-        KwpGoodsAddress goodsAddress = kwpGoodsAddressService.getByGoodsId(id);
-        AddressInfoDetail addressInfo = BeanUtils.copyProperties(goodsAddress, AddressInfoDetail.class);
-        if (Objects.nonNull(addressInfo)) {
-            addressInfo.setTypeName(DictEnum.getLabel(DictTypeEnum.ADDRESS_TYPE.getType(), addressInfo.getType()));
-        }
-        detail.setImages(images).setPriceRanges(ranges).setAttributes(attributes).setAddressInfo(addressInfo);
-
-        return detail;
+        GoodsDetail goodsDetail = kwpGoodsService.detail(id);
+        return BeanUtils.copyProperties(goodsDetail, OperationGoodsDetail.class);
     }
 
     /**
@@ -287,24 +181,11 @@ public class GoodsManagerService {
     public List<OperationGoodsListExport> export(OperatorGoodsExportQueryVO params) {
         LambdaQueryWrapper<KwpGoods> wrapper = buildWrapper(BeanUtils.copyProperties(params, OperatorGoodsListQueryDTO.class));
         List<KwpGoods> list = kwpGoodsMapper.selectList(wrapper);
-        List<OperationGoodsList> goodsLists = buildGoodLists(list);
-        if (CollectionUtils.isEmpty(goodsLists)) {
+        if (CollectionUtils.isEmpty(list)) {
             return Collections.emptyList();
         }
-        List<OperationGoodsListExport> result = new ArrayList<>();
-        AtomicInteger i = new AtomicInteger(1);
-        goodsLists.forEach(e -> {
-            OperationGoodsListExport export = BeanUtils.copyProperties(e, OperationGoodsListExport.class);
-            export.setSerialNumber(String.valueOf(i.getAndIncrement()))
-                    .setAmount(Objects.isNull(e.getAmount()) ? null : String.valueOf(e.getAmount()))
-                    .setHighestPrice(Objects.isNull(e.getHighestPrice()) ? null : String.valueOf(e.getHighestPrice()))
-                    .setLowestPrice(Objects.isNull(e.getLowestPrice()) ? null : String.valueOf(e.getLowestPrice()))
-                    .setAddedTime(Objects.isNull(e.getAddedTime()) ? null : DateUtil.getDateTime(e.getAddedTime()))
-                    .setShelfTime(Objects.isNull(e.getShelfTime()) ? null : DateUtil.getDateTime(e.getShelfTime()))
-                    .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()));
-            result.add(export);
-        });
-        return result;
+        List<GoodsListExport> exportResults = kwpGoodsService.getExportResults(list);
+        return BeanUtils.copyToList(exportResults, OperationGoodsListExport.class);
     }
 
 

+ 3 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/CommonService.java

@@ -140,7 +140,9 @@ public class CommonService {
         SckwMessage msg = new SckwMessage();
         Map<String, String> msgUrls = new HashMap<>(Global.NUMERICAL_FOUR);
         msgUrls.put(ClientTypeEnum.pc.getValue(), msgUrl);
-        msgUrls.put(ClientTypeEnum.app.getValue(), appMsgUrl);
+        if (StringUtils.isNotBlank(appMsgUrl)) {
+            msgUrls.put(ClientTypeEnum.app.getValue(), appMsgUrl);
+        }
         msg.setRequestId(UUIDUtils.get32UUID())
                 .setMessageEnum(messageEnum)
                 .setParams(map)

+ 32 - 22
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -79,9 +79,13 @@ public class KwsEnterpriseService {
     @Value(value = "${jumpUrl.entCertificate}")
     private String entCertificateUrl;
 
-    @Value(value = "${jumpUrl.entCertificate}")
+    @Value(value = "${jumpUrl.appEntCertificate}")
     private String appEntCertificateUrl;
 
+    @Value(value = "${jumpUrl.entDept}")
+    private String entDeptUrl;
+
+
     /**
      * @param params 入库
      * @desc: 单表入库
@@ -373,7 +377,10 @@ public class KwsEnterpriseService {
         }
 
         //子公司不用新建机构、角色等,直接返回
-        if (!Objects.isNull(reqVo.getEntPid())) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("entName", kwsEnterprise.getFirmName());
+        map.put("createByName", kwsEnterprise.getContacts());
+        if (Objects.nonNull(reqVo.getEntPid())) {
             KwsEntDept kwsEntDept = new KwsEntDept();
             kwsEntDept.setEntId(entId);
             kwsEntDept.setEntPid(reqVo.getEntPid());
@@ -381,15 +388,17 @@ public class KwsEnterpriseService {
             if (kwsEntDeptDao.insert(kwsEntDept) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
             }
-        }
 
-        Map<String, Object> map = new HashMap<>();
-        map.put("entName", kwsEnterprise.getFirmName());
-        map.put("createByName", kwsEnterprise.getContacts());
-        commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
-                MessageEnum.ENT_CERTIFICATE,
-                map,
-                entCertificateUrl,"");
+            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
+                    MessageEnum.ENT_CERTIFICATE,
+                    map,
+                    entDeptUrl, "");
+        } else {
+            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(userId).setEntId(entId)),
+                    MessageEnum.ENT_CERTIFICATE,
+                    map,
+                    entCertificateUrl, appEntCertificateUrl);
+        }
     }
 
     /**
@@ -484,10 +493,19 @@ public class KwsEnterpriseService {
                 messageEnum = MessageEnum.ENT_DEPT_CERTIFICATE_REFUSED;
             }
         }
-        commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(kwsEnterprise.getCreateBy()).setEntId(entId)),
-                messageEnum,
-                map,
-                entCertificateUrl,"");
+
+        if (Objects.isNull(kwsEntDept)) {
+            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(kwsEnterprise.getCreateBy()).setEntId(entId)),
+                    messageEnum,
+                    map,
+                    entCertificateUrl, appEntCertificateUrl);
+        } else {
+            commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(kwsEnterprise.getCreateBy()).setEntId(entId)),
+                    messageEnum,
+                    map,
+                    entDeptUrl, "");
+        }
+
     }
 
     /**
@@ -617,14 +635,6 @@ public class KwsEnterpriseService {
 
         //主体机构
         extracted(reqVo, new IdWorker(1L).nextId());
-        Map<String, Object> map = new HashMap<>();
-        map.put("entName", reqVo.getFirmName());
-        map.put("createByName", reqVo.getContacts());
-        commonService.sendSystemMessage(Collections.singletonList(new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId())),
-                MessageEnum.ENT_DEPT_CERTIFICATE,
-                map,
-                entCertificateUrl,
-                appEntCertificateUrl);
     }