From bcad3fe1b888ae11d437f6558b7974cfa30cfb2e Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 13 一月 2026 18:24:07 +0800
Subject: [PATCH] 经销商管理

---
 server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 174 insertions(+), 0 deletions(-)

diff --git a/server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java
index a34d8ba..2d919f1 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java
@@ -1,8 +1,13 @@
 package com.doumee.service.system.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.utils.Constants;
+import com.doumee.dao.system.SystemDictMapper;
+import com.doumee.dao.system.dto.PlatformConfigDTO;
 import com.doumee.dao.system.model.SystemDict;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -20,6 +25,8 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
@@ -33,6 +40,8 @@
 
     @Autowired
     private SystemDictDataMapper systemDictDataMapper;
+    @Autowired
+    private SystemDictMapper systemDictMapper;
 
     @Override
     public Integer create(SystemDictData systemDictData) {
@@ -112,4 +121,169 @@
                 .in(SystemDictData::getLabel,codes);
         return systemDictDataMapper.selectList(wrapper);
     }
+
+
+
+    @Override
+    public PlatformConfigDTO getPlatformConfigDTO(){
+        PlatformConfigDTO platformConfigDTO = new PlatformConfigDTO();
+        platformConfigDTO.setRegIntegralReward(new BigDecimal(0));
+        platformConfigDTO.setRegCouponRewardStatus(0);
+        platformConfigDTO.setRegCouponRewardList(new ArrayList<>());
+        platformConfigDTO.setRegIntegralRewardStatus(0);
+
+        platformConfigDTO.setShareIntegralReward(new BigDecimal(0));
+        platformConfigDTO.setShareCouponRewardList(new ArrayList<>());
+        platformConfigDTO.setShareIntegralRewardStatus(0);
+        platformConfigDTO.setShareCouponRewardStatus(0);
+
+        platformConfigDTO.setReturnMemberIntegral(new BigDecimal(0));
+        platformConfigDTO.setReturnShopIntegral(new BigDecimal(0));
+        platformConfigDTO.setReturnMemberIntegralStatus(0);
+        platformConfigDTO.setReturnShopIntegralStatus(0);
+
+        platformConfigDTO.setTotalRate(new BigDecimal(0));
+
+        SystemDict  dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
+                .eq(SystemDict::getCode,Constants.ORDER_SET).last("limit 1"));
+        if(dict == null){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏁版嵁瀛楀吀閰嶇疆鏁版嵁鏈夎锛岃鑱旂郴绯荤粺绠$悊鍛樺鐞嗭紒");
+        }
+
+        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>()
+                .lambda().eq(SystemDictData::getDictId,dict.getId())
+                .in(SystemDictData::getLabel
+                        , Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS
+                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS
+                        , Constants.ORDERSET_REG_COUPON_REWARD_STATUS
+                        , Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS
+                        , Constants.ORDERSET_REG_INTEGRAL_REWARD
+                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD
+                        , Constants.ORDERSET_REG_COUPON_REWARD_LIST
+                        , Constants.ORDERSET_SHARE_COUPON_REWARD_LIST
+                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS
+                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS
+                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL
+                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL
+                        ,Constants.ORDERSET_TOTAL_RATE )
+        );
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)){
+            for (SystemDictData systemDictData:systemDictDataList) {
+                if(systemDictData.getLabel().equals(Constants.ORDERSET_REG_INTEGRAL_REWARD)){
+                    platformConfigDTO.setRegIntegralReward(getDecimalValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_REG_COUPON_REWARD_STATUS)){
+                    platformConfigDTO.setRegCouponRewardStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_REG_COUPON_REWARD_LIST)){
+                    platformConfigDTO.setRegCouponRewardList(getListValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS)){
+                    platformConfigDTO.setRegIntegralRewardStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_INTEGRAL_REWARD)){
+                    platformConfigDTO.setShareIntegralReward(getDecimalValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_COUPON_REWARD_LIST)){
+                    platformConfigDTO.setShareCouponRewardList(getListValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS)){
+                    platformConfigDTO.setShareIntegralRewardStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS)){
+                    platformConfigDTO.setShareCouponRewardStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_MEMBER_INTEGRAL)){
+                    platformConfigDTO.setReturnMemberIntegral(getDecimalValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_SHOP_INTEGRAL)){
+                    platformConfigDTO.setReturnShopIntegral(getDecimalValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS)){
+                    platformConfigDTO.setReturnMemberIntegralStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS)){
+                    platformConfigDTO.setReturnShopIntegralStatus(getIntegerValByStr(systemDictData.getCode()));
+                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_TOTAL_RATE)) {
+                    platformConfigDTO.setTotalRate(getDecimalValByStr(systemDictData.getCode()));
+                }
+            }
+        }
+        return platformConfigDTO;
+    }
+
+    private Integer getIntegerValByStr(String code) {
+        try {
+            return Integer.parseInt(code);
+        }catch (Exception e){
+        }
+        return  0;
+    }
+    private BigDecimal getDecimalValByStr(String code) {
+        try {
+            return new BigDecimal(code);
+        }catch (Exception e){
+        }
+        return  new BigDecimal(0);
+    }
+    private List<JSONObject> getListValByStr(String code) {
+        try {
+            return JSONObject.parseObject(code,new TypeReference<List<JSONObject>>(){});
+        }catch (Exception e){
+        }
+        return  new ArrayList();
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class, BusinessException.class})
+    public void updPlatformConfig(PlatformConfigDTO platformConfigDTO) {
+        SystemDict dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
+                .eq(SystemDict::getCode, Constants.ORDER_SET).last("limit 1"));
+        if (dict == null) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "鏁版嵁瀛楀吀閰嶇疆鏁版嵁鏈夎锛岃鑱旂郴绯荤粺绠$悊鍛樺鐞嗭紒");
+        }
+        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>()
+                .lambda()
+                .eq(SystemDictData::getDictId, dict.getId())
+                .in(SystemDictData::getLabel
+                        , Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS
+                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS
+                        , Constants.ORDERSET_REG_COUPON_REWARD_STATUS
+                        , Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS
+                        , Constants.ORDERSET_REG_INTEGRAL_REWARD
+                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD
+                        , Constants.ORDERSET_REG_COUPON_REWARD_LIST
+                        , Constants.ORDERSET_SHARE_COUPON_REWARD_LIST
+                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS
+                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS
+                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL
+                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL
+                        , Constants.ORDERSET_TOTAL_RATE)
+        );
+        if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)) {
+            for (SystemDictData systemDictData : systemDictDataList) {
+                if (systemDictData.getLabel().equals(Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getRegIntegralRewardStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getShareIntegralRewardStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_REG_COUPON_REWARD_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getRegCouponRewardStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getShareCouponRewardStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_REG_INTEGRAL_REWARD)) {
+                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getRegIntegralReward()).doubleValue() + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_INTEGRAL_REWARD)) {
+                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getShareIntegralReward()).doubleValue() + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_REG_COUPON_REWARD_LIST)) {
+                    systemDictData.setCode(JSONObject.toJSONString(platformConfigDTO.getRegCouponRewardList() == null ? new ArrayList() : platformConfigDTO.getRegCouponRewardList()));
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_SHARE_COUPON_REWARD_LIST)) {
+                    systemDictData.setCode(JSONObject.toJSONString(platformConfigDTO.getShareCouponRewardList() == null ? new ArrayList() : platformConfigDTO.getShareCouponRewardList()));
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getReturnMemberIntegralStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS)) {
+                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getReturnShopIntegralStatus()) + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_MEMBER_INTEGRAL)) {
+                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getReturnMemberIntegral()).doubleValue() + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_RETURN_SHOP_INTEGRAL)) {
+                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getReturnShopIntegral()).doubleValue() + "");
+                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_TOTAL_RATE)) {
+                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getTotalRate()).doubleValue() + "");
+                }
+                systemDictDataMapper.update(new UpdateWrapper<SystemDictData>().lambda()
+                        .set(SystemDictData::getCode, systemDictData.getCode())
+                        .eq(SystemDictData::getId, systemDictData.getId()));
+            }
+        }
+    }
+
 }

--
Gitblit v1.9.3