From 4ab710d8d70017f090dd9601099ded1a50a58a10 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 27 四月 2026 22:34:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java | 62 +++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 12 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 9f7a9b3..d87fa92 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
@@ -27,6 +27,7 @@
import com.doumee.dao.business.model.PricingRule;
import com.doumee.dao.business.model.ShopInfo;
import com.doumee.dao.dto.*;
+import com.doumee.dao.system.model.SystemDictData;
import com.doumee.dao.system.SystemUserMapper;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.dao.vo.ShopDetailVO;
@@ -293,8 +294,7 @@
Integer shopId;
if (existing != null) {
// 鏍¢獙鐘舵�侊細鍙湁寰呭鎵�(0)鍜岃椹冲洖(2)鍙慨鏀�
- if (!Constants.equalsInteger(existing.getAuditStatus(), Constants.ZERO)
- && !Constants.equalsInteger(existing.getAuditStatus(), Constants.TWO)) {
+ if (!Constants.equalsInteger(existing.getAuditStatus(), Constants.TWO)) {
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠闂ㄥ簵鐘舵�佷笉鍏佽淇敼");
}
// 鏍¢獙openid鍖归厤锛氬綋鍓嶇櫥褰曚細鍛樼殑openid蹇呴』涓庨棬搴楃殑openid涓�鑷�
@@ -360,6 +360,7 @@
shopInfo.setSalt(salt);
shopInfo.setAliAccount(request.getAliAccount());
shopInfo.setAliName(request.getAliName());
+ shopInfo.setAuditStatus(Constants.ZERO);
shopInfo.setStatus(Constants.ZERO);
shopInfo.setDeleted(Constants.ZERO);
shopInfo.setCreateTime(now);
@@ -367,6 +368,8 @@
shopInfo.setRegionMemberId(member.getId());
// 璇诲彇鎶奸噾閲戦
setDepositAmountFromPricingRule(shopInfo);
+ // 璁剧疆榛樿閰嶉�佽寖鍥�
+ setDefaultDeliveryRange(shopInfo);
shopInfoMapper.insert(shopInfo);
shopId = shopInfo.getId();
}
@@ -469,7 +472,8 @@
if (Constants.equalsInteger(newAuditStatus, Constants.ONE)) {
// 瀹℃牳閫氳繃 鈫� 閫氱煡缂寸撼鎶奸噾
String depositMoney = shopInfo.getDepositAmount() != null
- ? String.valueOf(shopInfo.getDepositAmount() / 100.0) : "0";
+ ? new java.math.BigDecimal(shopInfo.getDepositAmount())
+ .divide(new java.math.BigDecimal(100), 2, java.math.RoundingMode.HALF_UP).toPlainString() : "0";
sendSmsNotify(shopInfo.getTelephone(),
Constants.SmsNotify.SHOP_AUTH_APPROVED_DEPOSIT,
"storeName", shopInfo.getName(),
@@ -757,6 +761,13 @@
}
}
+ // 闂ㄥ簵澶村儚锛氫紭鍏堜娇鐢� coverImg锛屼负绌哄垯鍙栭棬澶寸収绗竴寮�
+ if (StringUtils.isNotBlank(shopInfo.getCoverImg())) {
+ vo.setShopAvatar(imgPrefix + shopInfo.getCoverImg());
+ } else if (!CollectionUtils.isEmpty(vo.getStoreFrontImgUrls())) {
+ vo.setShopAvatar(vo.getStoreFrontImgUrls().get(0));
+ }
+
return vo;
}
@@ -787,7 +798,8 @@
// 闂ㄥ簵鍚嶇О妯$硦鏌ヨ
if (StringUtils.isNotBlank(dto.getName())) {
- qw.lambda().like(ShopInfo::getName, dto.getName());
+ qw.lambda().and(q -> q.like(ShopInfo::getName, dto.getName()).or()
+ .like(ShopInfo::getAddress, dto.getName()));
}
// 鍩庡競绛涢�夛紙areaId鏄尯鍘匡紝闇�鍖归厤鍏秔arentId绛変簬鍩庡競ID锛�
@@ -906,8 +918,8 @@
}
@Override
- public ShopInfoMaintainDTO getShopMaintainInfo(Integer memberId) {
- ShopInfo shop = shopInfoMapper.selectById(memberId);
+ public ShopInfoMaintainDTO getShopMaintainInfo(Integer shopId) {
+ ShopInfo shop = shopInfoMapper.selectById(shopId);
if (Objects.isNull(shop) || Constants.equalsInteger(shop.getDeleted(), Constants.ONE)) {
return null;
}
@@ -919,6 +931,10 @@
dto.setDeliveryArea(shop.getDeliveryArea());
dto.setShopHours(shop.getShopHours());
dto.setBusinessType(shop.getBusinessType());
+ // 澶村儚鍏ㄨ矾寰�
+ if (StringUtils.isNotBlank(shop.getCoverImg())) {
+ dto.setCoverImgUrl(getShopPrefix() + shop.getCoverImg());
+ }
return dto;
}
@@ -1134,7 +1150,6 @@
public ShopLoginVO shopPasswordLogin(ShopLoginDTO dto){
if(StringUtils.isBlank(dto.getTelephone())
|| StringUtils.isBlank(dto.getPassword())
- || StringUtils.isBlank(dto.getOpenid())
){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛鍚嶆垨瀵嗙爜涓嶈兘涓虹┖");
}
@@ -1144,6 +1159,12 @@
);
if(shop==null){
throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT);
+ }
+ if(!Constants.equalsInteger(shop.getAuditStatus(),Constants.THREE)){
+ if(Constants.equalsInteger(shop.getAuditStatus(),Constants.ONE)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璇峰畬鎴愬鎵规祦绋� - 鏀粯鎶奸噾");
+ }
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闂ㄥ簵瀹℃壒娴佺▼鏈畬鎴愶紝璇峰畬鎴愬鎵规祦绋�");
}
//鍔犲瘑瀵嗙爜
String pwd = Utils.Secure.encryptPassword( dto.getPassword(), shop.getSalt());
@@ -1168,7 +1189,6 @@
// 鍒涘缓token锛坓enerateTokenForRedis 宸茶嚜鍔ㄦ竻闄よ鐢ㄦ埛鏃oken锛屼繚璇佸敮涓�鏈夋晥锛�
String token = JwtTokenUtil.generateTokenForRedis(shop.getId(), Constants.TWO, JSONObject.toJSONString(shop), redisTemplate);
-
// 鏋勫缓鍝嶅簲
ShopLoginVO vo = new ShopLoginVO();
vo.setToken(token);
@@ -1318,6 +1338,16 @@
}
/**
+ * 浠庤繍钀ラ厤缃鍙栭粯璁ら厤閫佽寖鍥村苟璧嬪�煎埌闂ㄥ簵璁板綍
+ */
+ private void setDefaultDeliveryRange(ShopInfo shopInfo) {
+ SystemDictData data = systemDictDataBiz.queryByCode(Constants.OPERATION_CONFIG, Constants.OP_DEFAULT_DELIVERY_RANGE);
+ if (data != null && StringUtils.isNotBlank(data.getCode())) {
+ shopInfo.setDeliveryArea(new java.math.BigDecimal(data.getCode()));
+ }
+ }
+
+ /**
* 鍙戦�佺煭淇¢�氱煡锛堝け璐ヤ笉褰卞搷涓讳笟鍔★級
*/
private void sendSmsNotify(String phone, Constants.SmsNotify smsNotify, String... paramPairs) {
@@ -1352,11 +1382,14 @@
}
@Override
- public void changePassword(Integer shopId, String newPassword, String token) {
- if (StringUtils.isBlank(newPassword)) {
- throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵嗙爜涓嶈兘涓虹┖");
+ public void changePassword(Integer shopId, String oldPassword, String newPassword, String token) {
+ if (StringUtils.isBlank(oldPassword)) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鏃у瘑鐮佷笉鑳戒负绌�");
}
- // 鏍¢獙瀵嗙爜蹇呴』鍚屾椂鍖呭惈瀛楁瘝鍜屾暟瀛�
+ if (StringUtils.isBlank(newPassword)) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鏂板瘑鐮佷笉鑳戒负绌�");
+ }
+ // 鏍¢獙鏂板瘑鐮佸繀椤诲悓鏃跺寘鍚瓧姣嶅拰鏁板瓧
boolean hasLetter = newPassword.chars().anyMatch(Character::isLetter);
boolean hasDigit = newPassword.chars().anyMatch(Character::isDigit);
if (!hasLetter || !hasDigit) {
@@ -1367,6 +1400,11 @@
if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
+ // 鏍¢獙鏃у瘑鐮�
+ String oldEncryptPwd = Utils.Secure.encryptPassword(oldPassword, shopInfo.getSalt());
+ if (!oldEncryptPwd.equals(shopInfo.getPassword())) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鏃у瘑鐮侀敊璇�");
+ }
// 閲嶆柊鐢熸垚salt锛屽姞瀵嗘柊瀵嗙爜骞舵洿鏂�
String salt = RandomStringUtils.randomAlphabetic(6);
shopInfo.setPassword(Utils.Secure.encryptPassword(newPassword, salt));
--
Gitblit v1.9.3