From ce477aa3f4d34a65898c7e69162dde623182338b Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期四, 23 四月 2026 20:06:11 +0800
Subject: [PATCH] 代码生成

---
 server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java |   94 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 85 insertions(+), 9 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
index efd4e45..14b7636 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
@@ -14,6 +14,7 @@
 import com.doumee.core.utils.Utils;
 import com.doumee.biz.system.AreasBiz;
 import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.core.utils.aliyun.AliSmsService;
 import com.doumee.dao.business.MemberMapper;
 import com.doumee.dao.business.MultifileMapper;
 import com.doumee.dao.business.OrdersMapper;
@@ -36,6 +37,9 @@
 import com.doumee.dao.vo.ShopWebDetailVO;
 import com.doumee.service.business.AreasService;
 import com.doumee.service.business.ShopInfoService;
+import com.doumee.dao.business.SmsrecordMapper;
+import com.doumee.dao.business.model.Smsrecord;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -52,6 +56,7 @@
  * @author rk
  * @date 2026/04/08
  */
+@Slf4j
 @Service
 public class ShopInfoServiceImpl implements ShopInfoService {
 
@@ -84,6 +89,9 @@
 
     @Autowired
     private AreasService areasService;
+
+    @Autowired
+    private SmsrecordMapper smsrecordMapper;
     @Override
     public Integer create(ShopInfo shopInfo) {
         shopInfoMapper.insert(shopInfo);
@@ -197,6 +205,9 @@
         }
         if (pageWrap.getModel().getAreaId() != null) {
             queryWrapper.lambda().eq(ShopInfo::getAreaId, pageWrap.getModel().getAreaId());
+        }
+        if (pageWrap.getModel().getAddress() != null) {
+            queryWrapper.lambda().like(ShopInfo::getAddress, pageWrap.getModel().getAddress());
         }
         if (pageWrap.getModel().getAuditStatus() != null) {
             queryWrapper.lambda().eq(ShopInfo::getAuditStatus, pageWrap.getModel().getAuditStatus());
@@ -320,6 +331,8 @@
             existing.setAuditTime(null);
             existing.setAuditUserId(null);
             existing.setAuditStatus(Constants.ZERO);
+            // 璇诲彇鎶奸噾閲戦
+            setDepositAmountFromPricingRule(existing);
             shopInfoMapper.updateById(existing);
             shopId = existing.getId();
         } else {
@@ -352,6 +365,8 @@
             shopInfo.setCreateTime(now);
             shopInfo.setUpdateTime(now);
             shopInfo.setRegionMemberId(member.getId());
+            // 璇诲彇鎶奸噾閲戦
+            setDepositAmountFromPricingRule(shopInfo);
             shopInfoMapper.insert(shopInfo);
             shopId = shopInfo.getId();
         }
@@ -445,17 +460,27 @@
                 }
             }
 
-            // 3. 浠嶱ricingRule璇诲彇鎶奸噾閲戦
-            PricingRule pricingRule = pricingRuleMapper.selectOne(new QueryWrapper<PricingRule>().lambda()
-                    .eq(PricingRule::getDeleted, Constants.ZERO)
-                    .eq(PricingRule::getType, Constants.THREE)
-                    .eq(PricingRule::getFieldA, String.valueOf(shopInfo.getCompanyType()))
-                    .last("limit 1"));
-            if (pricingRule != null && StringUtils.isNotBlank(pricingRule.getFieldB())) {
-                shopInfo.setDepositAmount(Long.parseLong(pricingRule.getFieldB()));
-            }
+            // 3. 浠嶱ricingRule璇诲彇鎶奸噾閲戦锛堝鎵规椂鏇存柊锛�
+            setDepositAmountFromPricingRule(shopInfo);
         }
         shopInfoMapper.updateById(shopInfo);
+
+        // 鐭俊閫氱煡
+        if (Constants.equalsInteger(newAuditStatus, Constants.ONE)) {
+            // 瀹℃牳閫氳繃 鈫� 閫氱煡缂寸撼鎶奸噾
+            String depositMoney = shopInfo.getDepositAmount() != null
+                    ? String.valueOf(shopInfo.getDepositAmount() / 100.0) : "0";
+            sendSmsNotify(shopInfo.getTelephone(),
+                    Constants.SmsNotify.SHOP_AUTH_APPROVED_DEPOSIT,
+                    "storeName", shopInfo.getName(),
+                    "money", depositMoney);
+        } else if (Constants.equalsInteger(newAuditStatus, Constants.TWO)) {
+            // 瀹℃牳椹冲洖
+            sendSmsNotify(shopInfo.getTelephone(),
+                    Constants.SmsNotify.SHOP_AUTH_REJECTED,
+                    "storeName", shopInfo.getName(),
+                    "reason", auditDTO.getAuditRemark() != null ? auditDTO.getAuditRemark() : "");
+        }
     }
 
     @Override
@@ -1275,4 +1300,55 @@
         return errors;
     }
 
+    /**
+     * 浠嶱ricingRule璇诲彇鎶奸噾閲戦骞惰祴鍊煎埌闂ㄥ簵璁板綍
+     */
+    private void setDepositAmountFromPricingRule(ShopInfo shopInfo) {
+        if (shopInfo.getCompanyType() == null) {
+            return;
+        }
+        PricingRule pricingRule = pricingRuleMapper.selectOne(new QueryWrapper<PricingRule>().lambda()
+                .eq(PricingRule::getDeleted, Constants.ZERO)
+                .eq(PricingRule::getType, Constants.THREE)
+                .eq(PricingRule::getFieldA, String.valueOf(shopInfo.getCompanyType()))
+                .last("limit 1"));
+        if (pricingRule != null && StringUtils.isNotBlank(pricingRule.getFieldB())) {
+            shopInfo.setDepositAmount(Long.parseLong(pricingRule.getFieldB()));
+        }
+    }
+
+    /**
+     * 鍙戦�佺煭淇¢�氱煡锛堝け璐ヤ笉褰卞搷涓讳笟鍔★級
+     */
+    private void sendSmsNotify(String phone, Constants.SmsNotify smsNotify, String... paramPairs) {
+        if (StringUtils.isBlank(phone)) {
+            return;
+        }
+        String content = smsNotify.format(paramPairs);
+        try {
+            JSONObject templateParam = new JSONObject();
+            for (int i = 0; i < paramPairs.length - 1; i += 2) {
+                templateParam.put(paramPairs[i], paramPairs[i + 1]);
+            }
+            boolean result = AliSmsService.sendSms(phone, smsNotify.getTemplateCode(),
+                    templateParam.toJSONString());
+            if (result) {
+                log.info("鐭俊鍙戦�佹垚鍔�: phone={}, template={}", phone, smsNotify.name());
+            } else {
+                log.warn("鐭俊鍙戦�佸け璐�: phone={}, template={}", phone, smsNotify.name());
+            }
+            // 瀛樺偍鐭俊璁板綍
+            Smsrecord smsRecord = new Smsrecord();
+            smsRecord.setPhone(phone);
+            smsRecord.setContent(content);
+            smsRecord.setType(Constants.ONE);
+            smsRecord.setStatus(result ? Constants.ONE : Constants.ZERO);
+            smsRecord.setCreateTime(new Date());
+            smsRecord.setDeleted(Constants.ZERO);
+            smsrecordMapper.insert(smsRecord);
+        } catch (Exception e) {
+            log.error("鐭俊鍙戦�佸紓甯�: phone={}, template={}, error={}", phone, smsNotify.name(), e.getMessage());
+        }
+    }
+
 }

--
Gitblit v1.9.3